单向 mysql:Otter跨机房数据同步( 二 )


首先在计划保存otter配置信息的mysql数据库执行otter-manager-schema.sql脚本 。
manager的配置文件主要是manager/conf/otter.properties,如下所示(下面列出了建议和需要修改的):
[root@v-03-01-00223 conf]# cat otter.properties
## otter manager domain name
otter.domainName = 192.168.140.24 ## 建议改成所在服务器的ip,而不是默认的127.0.0.1,否则到时候启动的时候所有的连接指向的目标都是localhost,因为通常otter跑在linux环境,很多linux环境是没有图形化界面的,感觉这是个bug
## otter manager http port
otter.port = 8088 ## 如果非专用或者已经有了一些web应用在同一台服务器,建议改成其他的避免端口冲突,这里的端口号要和jetty.xml中的保持一致,这里也是,直接用个非8080端口就更友好了,比如weblogic 控制台7001,es控制台9200,rabbitmq控制台15672
## jetty web config xml
otter.jetty = jetty.xml
## otter manager database config
otter.database.driver.class.name = com.mysql.jdbc.Driver
otter.database.driver.url = jdbc:mysql://192.168.160.24:3306/otter ## otter配置信息维护的数据库地址,库名一般为otter/otter_manager/manager
otter.database.driver.username = root
otter.database.driver.password = 123456
## otter communication port
otter.communication.manager.port = 1099 ## node和manager通信的接口,一般不用修改
## otter communication pool size
otter.communication.pool.size = 10
## default zookeeper address
otter.zookeeper.cluster.default =192.168.160.24:2181 ## zk地址
## default zookeeper sesstion timeout = 60s
otter.zookeeper.sessionTimeout = 60000
## otter arbitrate connect manager config
otter.manager.address = ${otter.domainName}:${otter.communication.manager.port}
## should run in product mode , true/false
otter.manager.productionMode = true
## self-monitor enable or disable
otter.manager.monitor.self.enable = true
## self-montir interval , default 120s
otter.manager.monitor.self.interval = 120
## auto-recovery paused enable or disable
otter.manager.monitor.recovery.paused = true
# manager email user config
otter.manager.monitor.email.host = smtp.gmail.com
otter.manager.monitor.email.username =
otter.manager.monitor.email.password =
otter.manager.monitor.email.stmp.port = 465
上述配置修改之后,就可以启动manager了 。
[root@v-03-01-00223 bin]# pwd
/usr/local/otter_manager/bin
./startup.sh
查看日志
tail -fn 100 ../logs/manager.log
2019-09-11 09:24:55.223 [] INFO com.alibaba.otter.manager.deployer.JettyEmbedServer - ##Jetty Embed Server is startup!
2019-09-11 09:24:55.223 [] INFO com.alibaba.otter.manager.deployer.OtterManagerLauncher - ## the manager server is running now ......
Wed Sep 11 09:26:58 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing Applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
接下去就可以验证manager了 。
用浏览器打开http://192.168.160.24:8088/

单向 mysql:Otter跨机房数据同步

文章插图
 
默认情况下,进去的是匿名账户,只有只读查看的权限,登录为管理员才可以有操作权限,管理员账号为admin/admin(otter自带) 。
注:默认情况下是没有channel的,因为笔者的环境已经配置了在单向同步的,所以有显示一个channel 。
manager启动之后,需要配置使用的zk、canal、node等地址、端口等信息 。
zk配置
单向 mysql:Otter跨机房数据同步

文章插图
 

单向 mysql:Otter跨机房数据同步

文章插图
 
node配置
单向 mysql:Otter跨机房数据同步

文章插图
 

单向 mysql:Otter跨机房数据同步

文章插图
 
端口建议不要修改 。
机器添加完成以后,机器管理的列表中第一列就是nid(这个就是到时候要保存到node/conf/nix文件中的值),如下:
单向 mysql:Otter跨机房数据同步

文章插图
 
上述三种类型的节点配置完成后,manager前期的配置就完成了 。
manager配置完成之后,需要先启动相应的node节点,node节点启动之后,就可以配置真正的同步任务了 。


推荐阅读