MySql - Gventure Technology Pvt Ltd

MySql

MySQL

MySql

Currently, we are doing replication between two servers, i.e., VPN3 and VPN4. Our project needed continuous backup of the business-critical database on another server as we don’t want to lose any data while the server goes down. So we have implemented the below-mentioned steps. We are using the MySQL 5.1 version of MySQL. Any higher version is also suitable, as replication performance has been increased in MySQL 5.6 and above. So below mentioned steps are tested successfully on MySQL5.1; however, the same steps might work for another version that you need to sort out.

 

  • Step 01: Add my.cnf files as mentioned in the /etc/my.cnf (this holds several Mysql environment variables and values for smooth performance of the MySQL). Run below queries on both servers to create a user that will handle replications between these two servers.
  • MySQL > create user ‘replicator’ identified by ‘replicator’;
  • Step 02: Once added, these files are according to the server replication architecture you are following. Reboot the services of myself to take effect of changes.
  • mysql> service MySQL restart
  • on all servers, you want to do replication settings. (Currently, we are doing between two servers, but cyclic replication can be done between multiple servers as per project need).
  • Step 03: Create GRANT access for replication users on each server, i.e., VPN3 and VPN4. On VPN3, run the following command on MySQL CLI.
  • MYSQL>GRANT REPLICATION SLAVE ON *.* TO ‘replicator’@’10.3.140.70’ IDENTIFIED BY ‘replicator’;
  • MYSQL> FLUSH PRIVILEGES;
  • On VPN4, run the following command on MySQL CLI.
  • MYSQL> GRANT REPLICATION SLAVE ON *.* TO ‘replicator’@’10.34.188.148’ IDENTIFIED BY ‘replicator’;
  • MYSQL> FLUSH PRIVILEGES;
  • You can verify the replication user added on MySQL by running the following commands.
  • mysql> select user,host from mysql.user;
  • Also, verify the permissions status by running the below command.
  • mysql> select * from mysql.user where user=’replicator’;
  • Step 04: Run MySQL query on VPN4 server
  • MYSQL> SHOW MASTER STATUS;
  • +——————+———-+————–+——————+
  • | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
  • +——————+———-+————–+——————+
  • | mysql-bin.000002 | 35271224 | | |
  • +——————+———-+————–+——————+
  • One row in set (0.00 sec) and then run below mentioned MySQL command on slave, i.e., on VPN3 server with details mentioned above of File and Position in it.
  • MYSQL> CHANGE MASTER TO
  • MASTER_HOST=’192.168.1.21′,
  • MASTER_PORT=3306,
  • MASTER_USER=’replicator’,
  • MASTER_PASSWORD=’replicator’,
  • MASTER_LOG_FILE=’mysql-bin.000002′,
  • MASTER_LOG_POS=35271224;
  • Step 05: Run MySQL query on VPN3 server
  • MYSQL> SHOW MASTER STATUS;
  • +——————+———-+————–+——————+
  • | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
  • +——————+———-+————–+——————+
  • | mysql-bin.000003 | 37416567 | | |
  • +——————+———-+————–+——————+
  • One row in set (0.00 sec) and run this MySQL command on slave, i.e., on VPN4 server with details mentioned above of File and Position in it.
  • MYSQL> CHANGE MASTER TO
  • MASTER_HOST=’192.168.1.21′,
  • MASTER_PORT=3306,
  • MASTER_USER=’replicator’,
  • MASTER_PASSWORD=’replicator’,
  • MASTER_LOG_FILE=’mysql-bin.000003′,
  • MASTER_LOG_POS=37416567;
  • Step 06: Run MySQL query on VPN4 server
  • MYSQL> START SLAVE;
  • Wait 5 seconds, then on Server VPN4.
  • MYSQL> SHOW SLAVE STATUS\G
  • If Slave_IO_Running=Yes and Slave_SQL_Running=Yes, replication is working on VPN4
  • Step 07: Run MySQL query on VPN3 server
  • MYSQL> START SLAVE;
  • Wait 5 seconds, then on Server VPN3.
  • MYSQL> SHOW SLAVE STATUS\G
  • If Slave_IO_Running=Yes and Slave_SQL_Running=Yes, replication is working.

 

Now replication is successfully set on both the servers. Changes from one server will automatically be copied to another MySQL server. Changes always flow from Master Server to Slave Server as this is an asynchronous process, so there is a slight delay in copying data from one server to another server. Generally, this process is used for continuous backup of the DB to another server. Since we have created both servers as Master and Slave, any server VPN4 will be reflected in VPN3 and vice versa.

Apache

 

Apache HTTP Server is an open-source HTTP server to develop and maintain modern operating systems, including UNIX and Windows NT. The target of this server is to provide a protected, efficient and extensible server that provides HTTP services in synchronous with the current HTTP standards.

Apache is the most widely used web server software. Developed and maintained by Apache Software Foundation, Apache is open-source software available for free that runs on 67% of all web servers globally. It is fast, reliable, and secure, and it can be highly customized to gather the needs of many different environments by using extensions and modules. Most WordPress hosting providers use Apache as their web server software. However, WordPress can run on other web server software as well.

Key Features:
  • Improved caching modules (mod_cache, mod_disk_cache, mod_mem_cache).
  • A new structure for authentication and authorization support replace the authentication modules provided in the previous version.
  • Support for proxy load balancing (mod_proxy_balancer)
  • Support for managing huge files (namely, greater than 2GB) on 32-bit platforms

Subversion

 

Gventure provides support for the open-source Subversion version control tool. It is open-source and distributed as free software over the internet. It comes by default with most GNU/Linux distributions, so it’s in your system Might Be Already Installed. Subversion is used to keep up present and verifiable variants of records, such as source code, website pages, and documentation.

 

Useful Links
Contact Us
  • +91-935-5777377 
  • contact@gventure.net
  • G-187, Fourth floor , Sector 63 Noida UP, India