In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Today, read-write separation has been done with amoeba. The following steps are summarized:
Three linux:
1. 192.168.1.213 is used as an amoeba server
2. 192.168.1.184 is used in mysql database
3. 192.168.1.185 is used in mysql database
# service iptables stop
# setenforce 0
1. Java running environment is required to run amoeba, so install jdk environment first.
Rpm-ivh jdk-7u45-linux-i586.rpm
Vim / etc/profile tomcat configuration file
Add:
Export JAVA_HOME=/usr/java/jdk1.8.0_20
Export JAVA_BIN=/usr/java/jdk1.8.0_20/bin
Export PATH=$PATH:$JAVA_HOME/bin
Export CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Source / etc/profile makes the modified file effective immediately
Java-version display version
At this point, the display of the version of java shows that it is a success.
2. Configure amoeba
Create a folder for amoeba
Mkdir / root/amoeba
Tar zxvf amoeba-mysql-binary-2.2.0.tar.gz-C / root/amoeba
Cd / root/amoeba
1. Modify dbServer.xml first
Vim / root/amoeba/conf/dbServer.xml / / modify the file
2. Next, we will modify amoeba.xml.
Vim / root/amoeba/conf/amoeba.xml
_
# # dividing Line #
The operation of ok and amoeba comes to this stage first.
Let's go to the database of .1.184.
Service mysqld start
Mysql-uroot-p
Mysql > grant all on *. * to admin@'%' identified by '123456 create a remote user and authorize it
Mysql > flush privileges
Mysql > create database lxl; / / create the database lxl, which was used in the amoeba configuration file just now
Mysql > create table lxl.t_test (id int (3)); / / create tables in lxl database
Mysql > insert into lxl.t_test values (1); / / insert 3 records
Mysql > insert into lxl.t_test values (2)
Mysql > insert into lxl.t_test values (3)
# # dividing Line #
The database preparation on .1.184 is complete. Let's go to. 1.185 to get ready.
Service mysqld start
Mysql-uroot-p
Mysql > grant all on *. * to admin@'%' identified by '123456 create a remote user and authorize it
Mysql > flush privileges
Mysql > create database lxl; / / create the database lxl, which was used in the amoeba configuration file just now
Mysql > create table lxl.t_test (id int (3)); / / create tables in lxl database
Mysql > insert into lxl.t_test values (4); / / insert 2 records
Mysql > insert into lxl.t_test values (5)
# # dividing Line # #
Switch to the amoeba server and start amoeba
Cd / root/amoeba/bin
. / amoeba start&
# # dividing Line # #
Use Telnet to amoeba
Mysql-uamoeba-p1234-P8066-h 192.168.1.213 / / Log in to the proxy side using the username and password of the amoeba agent
You can insert data now, because the data from the previous two databases are different, and you can clearly see the difference if you insert one.
The separation of reading and writing is over. I hope it will be helpful to you!
Ps: when I was doing the experiment today, I did a master replication for two databases first. As a result, although the amoeba configuration was successful, the two databases were inserted into the database and synchronized in real time, entangling for a long time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.