Mycat global auto-increment, mycat global
Auto-increment type
[Root @ node002 conf] # vi/usr/local/mycat/conf/server. xml
Meaning of each parameter:
0: Local File Auto-increment mode.
1: use mysql auto-increment.
2: Use the local timestamp to auto-increment. (Linux time)
3: zk distributed mode
4: zookeeper auto-increment mode
Because it is not useful before 4, use the fourth (4: zookeeper auto-increment mode). The configuration steps are as follows:
1. Specify the auto-increment type (server. xml)
[Root @ node002 conf] # vi/usr/local/mycat/conf/server. xml
2. Specify the zookeeper address (myid. properties)
[Root @ node002 conf] # vi/usr/local/mycat/conf/myid. properties
3. Specify the primary key of the logical table and enable auto-increment (schema. xml)
[Root @ node002 conf] # vi/usr/local/mycat/conf/schema. xml
4. Specify the table id (MINID, MAXID, and CURID)
[Root @ node002 conf] #Vi/usr/local/mycat/conf/sequence_conf.properties
[Root @ node002] #Cd/usr/local/mycat/
[Root @ node002 bin] #./Mycat restart
Stopping Mycat-server...
Stopped Mycat-server.
Starting Mycat-server...
[Root @ node002 bin] #./Mycat status
Mycat-server is running (3075 ).
Connect to the server where zookeeper is located
ZooKeeper service command:
- 1. Display files in the root directory: ls/use the ls command to view the content contained in the current ZooKeeper
- 2. display the data in the root directory and file: ls2/view the data of the current node and the number of updates and other data
- 3. create a file and set the initial content: create/zk "test" to create a new znode node "zk" and its associated strings
- 4. get the file content: get/zk to check whether znode contains the string we created
- 5. Modify the file content: set/zk "zkbak" to set the string associated with zk
- 6. delete the file: delete/zk delete the created znode
- 7. Exit the client: quit
- 8. help Command: help
[Root @ node001 ~] #Cd/usr/local/zkCluster/
[Root @ node001 zkCluster] #Ls
Zk1 zk2 zk3 zookeeper. out
Enter the cluster node zk1
[Root @ node001 zkCluster] #./Zk1/bin/zkCli. sh
[Zk: localhost: 2181 (CONNECTED) 2]Ls/
[Dubbo, zookeeper]
Delete A service deployed on a node
[Zk: localhost: 2181 (CONNECTED) 3]Rmr/dubbo
[Zk: localhost: 2181 (CONNECTED) 5]Ls/
[Zookeeper]
Exit
[Zk: localhost: 2181 (CONNECTED) 6]Quit
Quitting...