Sunday, February 17, 2013

Linux route add using ‘route’ command

1.     Add/Check IP Address
# ifconfig eth0:1
eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:CA:67:96
          inet addr:192.168.101.114  Bcast:192.168.101.255  Mask:255.255.254.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:67 Base address:0x2000

2.       Check default gateway
# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.100.0   0.0.0.0         255.255.254.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U         0 0          0 eth0
0.0.0.0         10.0.0.1        0.0.0.0         UG        0 0          0 eth0

3.       Execute route command
# route add default gw 192.168.100.1 eth0:1

4.       Check new gateway
# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.100.0   0.0.0.0         255.255.254.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U         0 0          0 eth0
0.0.0.0         192.168.100.1   0.0.0.0         UG        0 0          0 eth0
0.0.0.0         10.0.0.1        0.0.0.0         UG        0 0          0 eth0

Monday, December 24, 2012

Last_Errno: 1007: Error 'can’t create database 'databasename'; database exists' on query. Default database: 'databasename'. Query: 'create database databasename'



1         Check below entry in slave server:
            mysql> show slave status\G;
Master_Log_File: mysql-bin.000006
            Read_Master_Log_Pos: 231202
                        Relay_Log_File: mysqld-relay-bin.000004
                        Relay_Log_Pos: 503
            Relay_Master_Log_File: mysql-bin.000003
           Slave_IO_Running: Yes
            Slave_SQL_Running: No
           
Note: 
a)      Both Master_Log_File and Relay_Master_Log_File must be same.
b)      Both Slave_IO_Running and Slave_SQL_Running must be yes.

2          Check file name and bin log position on master server:
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000006 |   231202 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

3.         Stop the slave server:
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)

4.         Change master log file name and log position
mysql> CHANGE MASTER TO MASTER_HOST='xxxxx.xxx.xx',MASTER_USER='master_user',MASTER_PASSWORD='master_user_password',MASTER_LOG_FILE='mysql-bin.000006',MASTER_LOG_POS=202;
Query OK, 0 rows affected (0.05 sec)

5.         Start Slave Server:
mysql> start slave ;
Query OK, 0 rows affected (0.01 sec)

6.         Check slave server status:
mysql> show slave status\G;
           Master_Log_File: mysql-bin.000006
            Read_Master_Log_Pos: 231202
                        Relay_Log_File: mysqld-relay-bin.000002
                        Relay_Log_Pos: 235
            Relay_Master_Log_File: mysql-bin.000006
            Slave_IO_Running: Yes
            Slave_SQL_Running: Yes