NacosSync 介绍
介绍
- NacosSync是一个支持多种注册中心的同步组件,基于Spring boot开发框架,数据层采用Spring Data JPA,遵循了标准的JPA访问规范,支持多种数据源存储,默认使用Hibernate实现,更加方便的支持表的自动创建更新
- 使用了高效的事件异步驱动模型, 支持多种自定义事件,使得同步任务处理的延时控制在3s,8C16G的单机能够支持6K的同步任务
- NacosSync除了单机部署,也提供了高可用的集群部署模式,NacosSync是无状态设计,将任务等状态数据迁移到了数据库,使得集群扩展非常方便
- 抽象出了Sync组件核心接口,通过注解对同步类型进行区分,使得开发者可以很容易的根据自己需求,去扩展不同注册中心,目前已支持的同步类型:
系统模块架构:
同步任务管理页面
注册中心管理页面
使用场景:
- 多个网络互通的Region之间服务共享,打破Region之间的服务调用限制
- 双向同步功能,支持Dubbo+Zookeeper服务平滑迁移到Dubbo+Nacos,享受Nacos更加优质的服务
NacosSync
安装mysql
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm rpm -ivh mysql80-community-release-el7-1.noarch.rpm rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 yum install mysql-server -y
启动mysql
[root@ip-10-0-3-215 ~]# systemctl start mysqld [root@ip-10-0-3-215 ~]# systemctl enable mysqld
安装NacosSync
[root@ip-10-0-3-215 ~]# wget https://github.com/nacos-group/nacos-sync/releases/download/0.4.7/nacosSync.0.4.7.tar.gz
配置NacosSync
[root@ip-10-0-3-215 ~]# tar zxf nacosSync.0.4.7.tar.gz [root@ip-10-0-3-215 ~]# cd nacosSync/ [root@ip-10-0-3-215 nacosSync]# cd conf/ [root@ip-10-0-3-215 conf]# vim application.properties server.port=8083 server.servlet.context-path=/ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.show_sql=false spring.cloud.discovery.enabled=false spring.datasource.url=jdbc:mysql://127.0.0.1:3306/nacos_sync?characterEncoding=utf8 spring.datasource.username=root spring.datasource.password=AAAfsdfwewrwer32@#$!@ management.endpoints.web.exposure.include=* management.endpoint.health.show-details=always
建库建表
[root@ip-10-0-3-215 conf]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: 8.0.30 MySQL Community Server - GPL Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database nacos_Sync; Query OK, 1 row affected (0.00 sec) mysql> use nacos_Sync; Database changed mysql> source /root/nacosSync/bin/nacosSync.sql Query OK, 0 rows affected, 1 warning (0.25 sec) Query OK, 0 rows affected, 1 warning (0.06 sec) Query OK, 0 rows affected, 1 warning (0.04 sec)
启动NacosSync服务器
[root@ip-10-0-3-215 bin]# pwd /root/nacosSync/bin [root@ip-10-0-3-215 bin]# sh startup.sh start =============JAVA_HOME:/data/app/jdk-13.0.1 =============BASE_DIR:/root/nacosSync =============JAVA:/data/app/jdk-13.0.1/bin/java nacossync is starting,you can check the /root/nacosSync/logs/nacossync_start.out
继续阅读
评论