Wednesday, April 26, 2017

Mysql Warning Using a password on the command line interface can be insecure

In new versions of mysql you will get such warning not to specify password in command line. We can resolve this warning by specifying it in file using the utility mysql_config_editor.

Set the credentials using the following command:
mysql_config_editor set --login-path=local --host=localhost --user=username --password

Now you can run the command as:
mysql --login-path=local -e "statement"

Instead of:
mysql -u username -p pass -e "statement"


An alternate way for the older version is to use --defaults-extra-file option.

Create a credentials file my.cnf

cat my.cnf
[mysql]
host = hostname
user = username
password = password

Then when you execute the mysql command specify the path to my.cnf command as

mysql --defaults-extra-file=/path_to/my.cnf

Tuesday, April 25, 2017

Ethernet bonding in rhel7 and centos 7

Load the bonding module:
[root@localhost network-scripts]# modprobe --first-time bonding

Check the module:
[root@localhost network-scripts]# modinfo bonding

Create bond interface as below
[root@localhost network-scripts]# cat ifcfg-bond0
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.56.114
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"

Create Slave 1:
[root@localhost network-scripts]# cat ifcfg-enp0s9
BOOTPROTO=none
NAME=enp0s9
DEVICE=enp0s9
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

Create Slave 2:
[root@localhost network-scripts]# cat ifcfg-enp0s10
BOOTPROTO=none
NAME=enp0s10
DEVICE=enp0s10
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
[root@localhost network-scripts]#

Bring the interfaces up and restart network:
[root@localhost network-scripts]# ifup bond0
[root@localhost network-scripts]# ifup ifcfg-enp0s9
[root@localhost network-scripts]# ifup ifcfg-enp0s10
[root@localhost network-scripts]# nmcli con reload
[root@localhost network-scripts]# systemctl restart network

Check the status of the bonding interface:
[root@localhost network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp0s10
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: enp0s10
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 15
Permanent HW addr: 08:00:27:1d:16:27
Slave queue ID: 0

Slave Interface: enp0s9
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 15
Permanent HW addr: 08:00:27:0a:f8:11
Slave queue ID: 0
[root@localhost network-scripts]#