Showing posts with label CLI. Show all posts
Showing posts with label CLI. Show all posts

Monday, April 24, 2017

MySQL CLI mode localhost ignoring --PORT option

I have a issue like this in the past, either in Java or PHP, but never dug into the details of how MySQL server treats its command-line options for Localhost connection.

Basically, Localhost would point to local machine and implicitly means local IP like 127.0.0.1.

For standard MySQL instance, port number is default to 3306. To connect MySQL on different port number is possible by changing port number directly. However, such behaviour is a little bit different on Localhost connection.

Even MariaDB shares common bugs/features with its variant MySQL.

When connecting to MySQL instance on Localhost, you can type the followings with success:
> mysql -uuser -p -hlocalhost -P3306
> mysql -uuser -p -hlocalhost -P3307
> mysql -uuser -p -hlocalhost -P80
> mysql -uuser -p -hlocalhost -P443

They will absolutely redirect you to the instance Localhost:3306. I think of this a bug, yet someone has got an explanation on the official site for years:

On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection protocol explicitly, even for localhost, by using the --protocol=TCP option.
MySQL is based on Unix development source so behaviour will follow even when it's complied to Windows release.

To reach one particular port number on Localhost, we must specify the actual IP address. This ensures MySQL connection is done through TCP protocol rather than socket file.

In other words,
> mysql -uuser -p -hlocalhost -P3306 --protocol=TCP
> mysql -uuser -p -hlocalhost -P3307 --protocol=TCP
> mysql -uuser -p -hlocalhost -P80 --protocol=TCP
> mysql -uuser -p -hlocalhost -P443 --protocol=TCP
> mysql -uuser -p -h127.0.0.1 -P3306
> mysql -uuser -p -h127.0.0.1 -P3307
> mysql -uuser -p -h127.0.0.1 -P80
> mysql -uuser -p -h127.0.0.1 -P443

This will make sure we connect to Localhost on the port number as specified.

Ref: https://dev.mysql.com/doc/refman/5.7/en/connecting.html





Wednesday, July 6, 2016

Upgrade ESXi from 5.5 Update 3 to 6.0 Update 2

The good thing in ESXi 5.5 is the upgrade process can be done via SSH terminal. This eliminates the CD-ROM burning process and carries out the entire upgrade remotely from my laptop. As mentioned before, it's not always the direct process for version upgrade in ESXi infrastructure.

I was looking for the HP custom version of offline bundle (namely "HPE Custom Image for VMware ESXi 6.0 U2 Offline Bundle") for the HP machines which supposedly gathered all the drivers it needs for installing ESXi onto HP machines. You may need to download different custom version or official offline bundle for other machines which are supported otherwise.

URL:
https://my.vmware.com/group/vmware/details?downloadGroup=OEM-ESXI60U2-HPE&productId=491

After uploading the zip file onto ESXi box's datastore via vSphere client, with the following command I just got this error message on my ESXi console:

~ #
~ # esxcli software vib update -d /vmfs/volumes/datastore1/VMware-ESXi-6.0.0-2494585-depot.zip
[DependencyError]
 VIB VMware_bootbank_esx-base_6.0.0-2.34.3620759 requires vsan >= 6.0.0-2.34, but the requirement cannot be satisfied within the ImageProfile.
 VIB VMware_bootbank_esx-base_6.0.0-2.34.3620759 requires vsan << 6.0.0-2.35, but the requirement cannot be satisfied within the ImageProfile.
 Please refer to the log file for more details.
~ #
~ #

Honestly, ESXi 5.5 doesn't quite like the new VIB module named vsan. In other words, it doesn't have vsan in the current profile. That's why the path for vid update failed. So, let's go through the upgrade process with profile update option.

To list the current profile name, use the following command:

~ # esxcli software sources profile list -d /vmfs/volumes/datastore1/VMware-ESXi-6.0.0-2494585-depot.zip
Name                                 Vendor                      Acceptance Level
-----------------------------------  --------------------------  ----------------
HPE-ESXi-6.0.0-Update2-600.9.5.0.48  Hewlett Packard Enterprise  PartnerSupported

This may give different result on every single ESXi box, so you may need to take note of your own box for the actual name of image profile. Here, we have a profile name called "HPE-ESXi-6.0.0-Update2-600.9.5.0.48".

Now, it's time to proceed the upgrade:

~ #
~ # esxcli software profile update -p HPE-ESXi-6.0.0-Update2-600.9.5.0.48 -d /vmfs/volumes/datastore1/VMware-ESXi-6.0.0-2494585-depot.zip
.
.

And then I got the followings:

Update Result
   Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
   Reboot Required: true
   VIBs Installed: BRCM_bootbank_net-tg3_3.137l.v60.1-1OEM.600.0.0.2494585, EMU_bootbank_elxnet_10.7.110.13-1OEM.600.0.0.2768847, EMU_bootbank_ima-be2iscsi_10.7.110.10-1OEM.600.0.0.2159203, EMU_bootbank_lpfc_10.7.110.4-1OEM.600.0.0.2768847, EMU_bootbank_scsi-be2iscsi_10.7.110.10-1OEM.600.0.0.2159203, HPE_bootbank_amsHelper_600.10.4.0-22.2494585, HPE_bootbank_conrep_6.0.0.01-01.00.7.2494585, HPE_bootbank_hpbootcfg_6.0.0.02-02.00.6.2494585, HPE_bootbank_hpe-build_600.9.5.0.48-2494585, HPE_bootbank_hpe-esxi-fc-enablement_600.2.5.20-2494585, HPE_bootbank_hpe-ilo_600.10.0.0.26-1OEM.600.0.0.2494585, HPE_bootbank_hpe-smx-provider_600.03.10.00.13-2768847, HPE_bootbank_hponcfg_6.0.0.04-00.14.4.2494585, HPE_bootbank_hpssacli_2.40.13.0-6.0.0.1854445, HPE_bootbank_hptestevent_6.0.0.01-01.00.5.2494585, Hewlett-Packard_bootbank_char-hpcru_6.0.6.14-1OEM.600.0.0.2159203, Hewlett-Packard_bootbank_hpnmi_600.2.3.14-2159203, Hewlett-Packard_bootbank_scsi-hpdsa_5.5.0.48-1OEM.550.0.0.1331820, Hewlett-Packard_bootbank_scsi-hpsa_6.0.0.116-1OEM.600.0.0.2494585, Intel_bootbank_intelcim-provider_0.5-1.6, Intel_bootbank_net-i40e_1.3.45-1OEM.550.0.0.1331820, Intel_bootbank_net-igb_5.3.1-1OEM.550.0.0.1331820, Intel_bootbank_net-ixgbe_4.1.1.1-1OEM.550.0.0.1331820, MEL_bootbank_nmlx4-core_3.1.0.0-1OEM.600.0.0.2348722, MEL_bootbank_nmlx4-en_3.1.0.0-1OEM.600.0.0.2348722, MEL_bootbank_nmst_4.0.2.1-1OEM.600.0.0.2295424, QLogic_bootbank_misc-cnic-register_1.712.70.v60.1-1OEM.600.0.0.2494585, QLogic_bootbank_net-bnx2_2.2.5k.v60.1-1OEM.600.0.0.2494585, QLogic_bootbank_net-bnx2x_2.712.70.v60.3-1OEM.600.0.0.2494585, QLogic_bootbank_net-cnic_2.712.70.v60.3-1OEM.600.0.0.2494585, QLogic_bootbank_net-nx-nic_6.0.643-1OEM.600.0.0.2494585, QLogic_bootbank_net-qlcnic_6.1.191-1OEM.600.0.0.2494585, QLogic_bootbank_qlnativefc_2.1.30.0-1OEM.600.0.0.2768847, QLogic_bootbank_scsi-bnx2fc_1.712.70.v60.5-1OEM.600.0.0.2494585, QLogic_bootbank_scsi-bnx2i_2.712.70.v60.2-1OEM.600.0.0.2494585, VMWARE_bootbank_mtip32xx-native_3.8.5-1vmw.600.0.0.2494585, VMware_bootbank_ata-pata-amd_0.3.10-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-atiixp_0.4.6-4vmw.600.0.0.2494585, VMware_bootbank_ata-pata-cmd64x_0.2.5-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-hpt3x2n_0.3.4-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-pdc2027x_1.0-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-serverworks_0.4.3-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-sil680_0.4.8-3vmw.600.0.0.2494585, VMware_bootbank_ata-pata-via_0.3.3-2vmw.600.0.0.2494585, VMware_bootbank_block-cciss_3.6.14-10vmw.600.0.0.2494585, VMware_bootbank_cpu-microcode_6.0.0-0.0.2494585, VMware_bootbank_ehci-ehci-hcd_1.0-3vmw.600.2.34.3620759, VMware_bootbank_emulex-esx-elxnetcli_10.2.309.6v-0.0.2494585, VMware_bootbank_esx-base_6.0.0-2.34.3620759, VMware_bootbank_esx-dvfilter-generic-fastpath_6.0.0-0.0.2494585, VMware_bootbank_esx-tboot_6.0.0-2.34.3620759, VMware_bootbank_esx-ui_1.0.0-3617585, VMware_bootbank_esx-xserver_6.0.0-0.0.2494585, VMware_bootbank_ipmi-ipmi-devintf_39.1-4vmw.600.0.0.2494585, VMware_bootbank_ipmi-ipmi-msghandler_39.1-4vmw.600.0.0.2494585, VMware_bootbank_ipmi-ipmi-si-drv_39.1-4vmw.600.0.0.2494585, VMware_bootbank_lsi-mr3_6.605.08.00-7vmw.600.1.17.3029758, VMware_bootbank_lsi-msgpt3_06.255.12.00-8vmw.600.1.17.3029758, VMware_bootbank_lsu-hp-hpsa-plugin_1.0.0-1vmw.600.0.0.2494585, VMware_bootbank_lsu-lsi-lsi-mr3-plugin_1.0.0-2vmw.600.0.11.2809209, VMware_bootbank_lsu-lsi-lsi-msgpt3-plugin_1.0.0-1vmw.600.0.0.2494585, VMware_bootbank_lsu-lsi-megaraid-sas-plugin_1.0.0-2vmw.600.0.11.2809209, VMware_bootbank_lsu-lsi-mpt2sas-plugin_1.0.0-4vmw.600.1.17.3029758, VMware_bootbank_lsu-lsi-mptsas-plugin_1.0.0-1vmw.600.0.0.2494585, VMware_bootbank_misc-drivers_6.0.0-2.34.3620759, VMware_bootbank_net-e1000_8.0.3.1-5vmw.600.0.0.2494585, VMware_bootbank_net-enic_2.1.2.38-2vmw.600.0.0.2494585, VMware_bootbank_net-forcedeth_0.61-2vmw.600.0.0.2494585, VMware_bootbank_net-vmxnet3_1.1.3.0-3vmw.600.2.34.3620759, VMware_bootbank_nmlx4-rdma_3.0.0.0-1vmw.600.0.0.2494585, VMware_bootbank_nvme_1.2.0.27-4vmw.550.0.0.1331820, VMware_bootbank_ohci-usb-ohci_1.0-3vmw.600.0.0.2494585, VMware_bootbank_rste_2.0.2.0088-4vmw.600.0.0.2494585, VMware_bootbank_sata-ahci_3.0-22vmw.600.2.34.3620759, VMware_bootbank_sata-ata-piix_2.12-10vmw.600.0.0.2494585, VMware_bootbank_sata-sata-nv_3.5-4vmw.600.0.0.2494585, VMware_bootbank_sata-sata-promise_2.12-3vmw.600.0.0.2494585, VMware_bootbank_sata-sata-sil24_1.1-1vmw.600.0.0.2494585, VMware_bootbank_sata-sata-sil_2.3-4vmw.600.0.0.2494585, VMware_bootbank_sata-sata-svw_2.3-3vmw.600.0.0.2494585, VMware_bootbank_scsi-aacraid_1.1.5.1-9vmw.600.0.0.2494585, VMware_bootbank_scsi-adp94xx_1.0.8.12-6vmw.600.0.0.2494585, VMware_bootbank_scsi-aic79xx_3.1-5vmw.600.0.0.2494585, VMware_bootbank_scsi-fnic_1.5.0.45-3vmw.600.0.0.2494585, VMware_bootbank_scsi-ips_7.12.05-4vmw.600.0.0.2494585, VMware_bootbank_scsi-megaraid-mbox_2.20.5.1-6vmw.600.0.0.2494585, VMware_bootbank_scsi-megaraid-sas_6.603.55.00-2vmw.600.0.0.2494585, VMware_bootbank_scsi-megaraid2_2.00.4-9vmw.600.0.0.2494585, VMware_bootbank_scsi-mptsas_4.23.01.00-9vmw.600.0.0.2494585, VMware_bootbank_scsi-mptspi_4.23.01.00-9vmw.600.0.0.2494585, VMware_bootbank_uhci-usb-uhci_1.0-3vmw.600.0.0.2494585, VMware_bootbank_vsan_6.0.0-2.34.3563498, VMware_bootbank_vsanhealth_6.0.0-3000000.3.0.2.34.3544323, VMware_bootbank_xhci-xhci_1.0-3vmw.600.2.34.3620759, VMware_locker_tools-light_6.0.0-2.34.3620759
   VIBs Removed: Broadcom_bootbank_net-tg3_3.137l.v55.1-1OEM.550.0.0.1331820, Emulex_bootbank_elxnet_10.5.121.7-1OEM.550.0.0.1331820, Emulex_bootbank_ima-be2iscsi_10.5.65.7-1OEM.550.0.0.1331820, Emulex_bootbank_lpfc_10.5.39.0-1OEM.550.0.0.1331820, Emulex_bootbank_scsi-be2iscsi_10.5.65.7-1OEM.550.0.0.1331820, Hewlett-Packard_bootbank_char-hpcru_5.5.6.6-1OEM.550.0.0.1198610, Hewlett-Packard_bootbank_char-hpilo_550.9.0.2.3-1OEM.550.0.0.1198610, Hewlett-Packard_bootbank_hp-ams_550.10.3.0-15.1198610, Hewlett-Packard_bootbank_hp-build_550.9.4.26-1198610, Hewlett-Packard_bootbank_hp-conrep_5.5.0.1-0.0.8.1198610, Hewlett-Packard_bootbank_hp-esxi-fc-enablement_550.2.4.6-1198610, Hewlett-Packard_bootbank_hp-smx-provider_550.03.09.00.15-1198610, Hewlett-Packard_bootbank_hpbootcfg_5.5.0.02-01.00.5.1198610, Hewlett-Packard_bootbank_hpnmi_550.2.3.5-1198610, Hewlett-Packard_bootbank_hponcfg_5.5.0.4.4-0.3.1198610, Hewlett-Packard_bootbank_hpssacli_2.30.6.0-5.5.0.1198611, Hewlett-Packard_bootbank_hptestevent_5.5.0.01-00.01.4.1198610, Hewlett-Packard_bootbank_scsi-hpdsa_5.5.0.46-1OEM.550.0.0.1331820, Hewlett-Packard_bootbank_scsi-hpsa_5.5.0.114-1OEM.550.0.0.1331820, Intel_bootbank_intelcim-provider_0.5-1.4, Intel_bootbank_net-i40e_1.2.48-1OEM.550.0.0.1331820, Intel_bootbank_net-igb_5.2.10-1OEM.550.0.0.1331820, Intel_bootbank_net-ixgbe_3.21.4.3-1OEM.550.0.0.1331820, QLogic_bootbank_misc-cnic-register_1.712.50.v55.1-1OEM.550.0.0.1331820, QLogic_bootbank_net-bnx2_2.2.5j.v55.3-1OEM.550.0.0.1331820, QLogic_bootbank_net-bnx2x_2.712.50.v55.6-1OEM.550.0.0.1331820, QLogic_bootbank_net-cnic_2.712.50.v55.6-1OEM.550.0.0.1331820, QLogic_bootbank_net-nx-nic_5.5.643-1OEM.550.0.0.1331820, QLogic_bootbank_net-qlcnic_5.5.190-1OEM.550.0.0.1331820, QLogic_bootbank_qlnativefc_1.1.55.0-1OEM.550.0.0.1331820, QLogic_bootbank_scsi-bnx2fc_1.712.50.v55.7-1OEM.550.0.0.1331820, QLogic_bootbank_scsi-bnx2i_2.712.50.v55.4-1OEM.550.0.0.1331820, VMware_bootbank_ata-pata-amd_0.3.10-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-atiixp_0.4.6-4vmw.550.0.0.1331820, VMware_bootbank_ata-pata-cmd64x_0.2.5-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-hpt3x2n_0.3.4-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-pdc2027x_1.0-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-serverworks_0.4.3-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-sil680_0.4.8-3vmw.550.0.0.1331820, VMware_bootbank_ata-pata-via_0.3.3-2vmw.550.0.0.1331820, VMware_bootbank_block-cciss_3.6.14-10vmw.550.0.0.1331820, VMware_bootbank_ehci-ehci-hcd_1.0-3vmw.550.0.0.1331820, VMware_bootbank_esx-base_5.5.0-3.71.3116895, VMware_bootbank_esx-dvfilter-generic-fastpath_5.5.0-0.0.1331820, VMware_bootbank_esx-tboot_5.5.0-2.33.2068190, VMware_bootbank_esx-ui_0.0.2-0.1.3357452, VMware_bootbank_esx-xlibs_5.5.0-0.0.1331820, VMware_bootbank_esx-xserver_5.5.0-0.0.1331820, VMware_bootbank_ipmi-ipmi-devintf_39.1-4vmw.550.0.0.1331820, VMware_bootbank_ipmi-ipmi-msghandler_39.1-4vmw.550.0.0.1331820, VMware_bootbank_ipmi-ipmi-si-drv_39.1-4vmw.550.0.0.1331820, VMware_bootbank_lsi-mr3_0.255.03.01-2vmw.550.3.68.3029944, VMware_bootbank_lsi-msgpt3_00.255.03.03-1vmw.550.1.15.1623387, VMware_bootbank_misc-drivers_5.5.0-3.68.3029944, VMware_bootbank_mtip32xx-native_3.3.4-1vmw.550.1.15.1623387, VMware_bootbank_net-be2net_4.6.100.0v-1vmw.550.0.0.1331820, VMware_bootbank_net-e1000_8.0.3.1-3vmw.550.0.0.1331820, VMware_bootbank_net-enic_1.4.2.15a-1vmw.550.0.0.1331820, VMware_bootbank_net-forcedeth_0.61-2vmw.550.0.0.1331820, VMware_bootbank_net-vmxnet3_1.1.3.0-3vmw.550.2.39.2143827, VMware_bootbank_ohci-usb-ohci_1.0-3vmw.550.0.0.1331820, VMware_bootbank_rste_2.0.2.0088-4vmw.550.1.15.1623387, VMware_bootbank_sata-ahci_3.0-22vmw.550.3.68.3029944, VMware_bootbank_sata-ata-piix_2.12-10vmw.550.2.33.2068190, VMware_bootbank_sata-sata-nv_3.5-4vmw.550.0.0.1331820, VMware_bootbank_sata-sata-promise_2.12-3vmw.550.0.0.1331820, VMware_bootbank_sata-sata-sil24_1.1-1vmw.550.0.0.1331820, VMware_bootbank_sata-sata-sil_2.3-4vmw.550.0.0.1331820, VMware_bootbank_sata-sata-svw_2.3-3vmw.550.0.0.1331820, VMware_bootbank_scsi-aacraid_1.1.5.1-9vmw.550.0.0.1331820, VMware_bootbank_scsi-adp94xx_1.0.8.12-6vmw.550.0.0.1331820, VMware_bootbank_scsi-aic79xx_3.1-5vmw.550.0.0.1331820, VMware_bootbank_scsi-fnic_1.5.0.4-1vmw.550.0.0.1331820, VMware_bootbank_scsi-ips_7.12.05-4vmw.550.0.0.1331820, VMware_bootbank_scsi-megaraid-mbox_2.20.5.1-6vmw.550.0.0.1331820, VMware_bootbank_scsi-megaraid-sas_5.34-9vmw.550.3.68.3029944, VMware_bootbank_scsi-megaraid2_2.00.4-9vmw.550.0.0.1331820, VMware_bootbank_scsi-mptsas_4.23.01.00-9vmw.550.3.68.3029944, VMware_bootbank_scsi-mptspi_4.23.01.00-9vmw.550.3.68.3029944, VMware_bootbank_uhci-usb-uhci_1.0-3vmw.550.0.0.1331820, VMware_bootbank_xhci-xhci_1.0-2vmw.550.3.68.3029944, VMware_locker_tools-light_5.5.0-3.68.3029944
   VIBs Skipped: Avago_bootbank_scsi-mpt2sas_15.10.06.00-1OEM.550.0.0.1331820, Hewlett-Packard_bootbank_scsi-hpvsa_5.5.0.100-1OEM.550.0.0.1331820, QLogic_bootbank_scsi-bfa_3.2.5.0-1OEM.550.0.0.1331820, QLogic_bootbank_scsi-qla4xxx_644.6.05.0-1OEM.600.0.0.2494585, VMware_bootbank_ima-qla4xxx_2.02.18-1vmw.600.0.0.2494585, VMware_bootbank_net-e1000e_3.2.2.1-1vmw.600.1.26.3380124, VMware_bootbank_net-mlx4-core_1.9.7.0-1vmw.600.0.0.2494585, VMware_bootbank_net-mlx4-en_1.9.7.0-1vmw.600.0.0.2494585

Such a long passage reporting how things are done. It's successful anyway. You need to reboot the ESXi box to make changes effective.

NB: You may need to use boot option like "noIOMMU" during the reboot process.

To enable noIOMMU option via SSH, try this command:
> esxcli system settings kernel set –setting=noIOMMU -v TRUE