Cluster mounting step MyCat + MySql

Description: mysql is based on the individual installation finished.
A mounting step .MyCat + MySql cluster
---- --------------- from two primary and two
mounting Master (primary) mysql 1.
Step 1: Installation mysql Single
Step 2 : modify /etc/my.cnf [reference my.cnf folder using file my.cnf]
# Vim /etc/my.cnf
-> Server-ID. 1 =
-> = master_log log_bin
Server-ID modified, this is mysql services to uniquely identify, using natural numbers.
server-id Master Slave unique identification number must be less than the unique identification number.
log file name, open the log function. This log is the command log. The record is the main library of SQL commands executed in the [only the primary from backups when necessary]
Step 3: Restart Mysql
`` MySQL restart # Service

 步骤4: 创建用户,提供slave访问 
    grant all privileges on *.* to 'slave'@'192.168.199.133' identified by 'slave' with grant option;
       flush privileges;
   步骤5: 查看用户和 查看Master信息
        use mysql;
        select host,name from user;
        show master status;

2. Installation Slave (from) mysql
Step 1: Installation mysql Single
Step 2: Modify /etc/my.cnf
# Vim /etc/my.cnf
-> Server-ID. 3 =
Step. 3: UUID
# Vim / usr / local / mysql / data / auto.cnf
ensure uuid master and slave is not the same as
the default location: / var / lib / mysql directory file name is auto.cnf.
step 4: restart Mysql
-Service MySQL the restart
step 5: configure the primary repository of information
use MySQL;
Change MASTER_HOST = Master to '192.168.126.142', MASTER_USER = 'Slave', master_password = 'Slave', MASTER_LOG_FILE = 'master2_log.000001';
step 6: start Slave function
start slave;
step 8: View Slave configuration
mysql> Slave Status Show \ G;
3. installation master (primary) MySQL
step 1: above a
Server-ID = 2
log_bin = master2_log
4. installation Slave (from) MySQL
step 1: Same as above 2
ID. 4 =-Server
---- two main configuration of the main cross -----------
---- ----------------- mounted myCat -
step 1: installation jdk
step 2: installation mysql master-slave configuration
step 3: Extract software installed mycat
step 4: configuration file rule.xml idcrc32slot user_idcrc32slot step 5: configuration file schemal.xml



    <mycat:schema xmlns:mycat="http://io.mycat/">
	    <schema name="ego" checkSQLschema="false" sqlMaxLimit="100">
	    	<table name="tb_content" dataNode="dn1,dn2,dn3,dn4" rule="crc32slot" />
		<table name="tb_content_category" dataNode="dn1,dn2,dn3,dn4" rule="crc32slot1"/>
	    </schema>
	   <dataNode name="dn1" dataHost="localhost1" database="ego1" />
	   <dataNode name="dn2" dataHost="localhost1" database="ego2" />
	   <dataNode name="dn3" dataHost="localhost1" database="ego3" />
	  <dataNode name="dn4" dataHost="localhost1" database="ego4" />
	  <dataHost name="localhost1" maxCon="1000" minCon="10" balance="0" writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
		<heartbeat>select user()</heartbeat>
		<writeHost host="hostM1" url="192.168.126.140:3306" user="root" password="root">
			<readHost host="hostS2" url="192.168.126.141:3306" user="root" password="root"/>
		</writeHost>
	</dataHost>
</mycat:schema>
  步骤6:配置serverl.xml文件,mycat用户名和密码,默认端口8066
		<user name="root">
	<property name="password">root</property>
	<property name="schemas">ego</property>
	</user>
	<user name="user">
	<property name="password">user</property>
	<property name="schemas">ego</property>
	<property name="readOnly">true</property>
	</user>

Step 7: Start myCat
# ./mycat Start
Step 8: develop port 8066

Released the 20 original articles · won praise 0 · Views 1200

Guess you like

Origin blog.csdn.net/jinhuding/article/details/104988538