One. Synchronization scenario
The old cluster is mixed with multiple services, and data needs to be synchronized to the new cluster, and some services are cut to the new cluster. At the same time, the old cluster continues to use other services and cannot be affected. Impact: The business cannot pre-write data to the new cluster. When switching to the new cluster, the data must be consistent with the original cluster.
2. Synchronization method
Add an observer node to the old cluster, and each observer node synchronizes the data in the old cluster. After the synchronization is completed, modify the configuration of each observer node to a new cluster, restart observer node.
3. Synchronization steps
1. Configure the new node as the observer node of the old cluster; modify the configuration file as follows:
tickTime=2000 initLimit=10 syncLimit=5 dataLogDir=/data/zookeeper-3.4.8/logs autopurge.purgeInterval=24 autopurge.snapRetainCount=3 dataDir=/data/zookeeper-3.4.8/data clientPort=2182 server.1:10.167.21.140:2889:3889 server.2:10.167.21.141:2889:3889 server.3:10.167.21.14:2889:3889
#Add the following lines to the observer node, the old cluster configuration file remains unchanged server.4:10.167.21.137:2889:3889:observer server.5:10.167.21.138:2889:3889:observer server.6:10.167.21.139:2889:3889:observer
2. Check whether the data of each observer node has been synchronized;
3. Modify the observer configuration file, restart the observer nodes one by one, the old cluster configuration file remains unchanged;
tickTime=2000 initLimit=10 syncLimit=5 dataLogDir=/data/zookeeper-3.4.8/logs autopurge.purgeInterval=24 autopurge.snapRetainCount=3 dataDir=/data/zookeeper-3.4.8/data clientPort=2182 #server.1:10.167.21.140:2889:3889 #server.2:10.167.21.141:2889:3889 #server.3:10.167.21.14:2889:3889 server.4:10.167.21.137:2889:3889 server.5:10.167.21.138:2889:3889 server.6:10.167.21.139:2889:3889
4. Confirm the status and data of the old and new clusters;
< /p>
tickTime=2000 initLimit=10 syncLimit=5 dataLogDir=/data/zookeeper-3.4.8/logs autopurge.purgeInterval=24 autopurge.snapRetainCount=3 dataDir=/data/zookeeper-3.4.8/data clientPort=2182 server.1:10.167.21.140:2889:3889 server.2:10.167.21.141:2889:3889 server.3:10.167.21.14:2889:3889
#Add the following lines to the observer node, the old cluster configuration file remains unchanged server.4:10.167.21.137:2889:3889:observer server.5:10.167.21.138:2889:3889:observer server.6:10.167.21.139:2889:3889:observer
tickTime=2000 initLimit=10 syncLimit=5 dataLogDir=/data/zookeeper-3.4.8/logs autopurge.purgeInterval=24 autopurge.snapRetainCount=3 dataDir=/data/zookeeper-3.4.8/data clientPort=2182 #server.1:10.167.21.140:2889:3889 #server.2:10.167.21.141:2889:3889 #server.3:10.167.21.14:2889:3889 server.4:10.167.21.137:2889:3889 server.5:10.167.21.138:2889:3889 server.6:10.167.21.139:2889:3889