數據庫同步:alibaba otter(水獺)

官網:https://zookeeper.apache.org

[root@wallet01 ~]# tar zxvf zookeeper-3.4.13.tar.gz -C /usr/local/
[root@wallet01 ~]# cd /usr/local/zookeeper-3.4.13/conf
[root@wallet01 conf]# mv zoo_sample.cfg zoo.cfg

[root@wallet01 conf]# vi log4j.properties
log4j.rootLogger=INFO,ROLLINGFILE

[root@wallet01 ~]# cd /usr/local/zookeeper-3.4.13/bin
[root@wallet01 bin]# vi zkEnv.sh
if [ "x${ZOO_LOG_DIR}" = "x" ]
then
    ZOO_LOG_DIR="/usr/local/zookeeper-3.4.13/logs"
fi

if [ "x${ZOO_LOG4J_PROP}" = "x" ]
then
    ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
fi

[root@wallet01 ~]# mkdir -p /usr/local/zookeeper-3.4.13/logs

[root@wallet01 ~]# vi /etc/profile
PATH=$PATH:/usr/local/zookeeper-3.4.13/bin

[root@wallet01 ~]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.13/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[root@wallet01 ~]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: standalone

官網:https://github.com/alibaba/otter 

項目介紹:
名稱:otter ['ɒtə(r)]
譯意: 水獺
語言: 純java開發
定位: 基於數據庫增量日誌解析,準實時同步到本機房或異地機房的mysql/oracle數據庫.

工作原理:
1. 基於Canal開源產品,獲取數據庫增量日誌數據。
2. 管理系統架構,manager(web管理)+node(工作節點)
    a. manager運行時推送同步配置到node節點
    b. node節點將同步狀態反饋到manager上
3. 基於zookeeper,解決分佈式狀態調度的,允許多node節點之間協同工作.

[root@wallet01 ~]# wget https://raw.github.com/alibaba/otter/master/manager/deployer/src/main/resources/sql/otter-manager-schema.sql --no-check-certificate

[root@wallet01 ~]# mysql -uroot -pabcd.1234
mysql> source otter-manager-schema.sql

mysql> grant all privileges on *.* to 'otter'@'%' identified by 'otter' with grant option;
query ok, 0 rows affected (0.04 sec)

mysql> flush privileges;
query ok, 0 rows affected (0.05 sec)

[root@wallet01 ~]# mkdir -p /usr/local/manager
[root@wallet01 ~]# tar zxvf manager.deployer-4.2.16.tar.gz -C /usr/local/manager
[root@wallet01 ~]# cd /usr/local/manager/conf/
[root@wallet01 conf]# vi otter.properties 
## otter manager domain name
otter.domainName = 192.168.40.37
## otter manager http port
otter.port = 8080

## otter manager database config
otter.database.driver.class.name = com.mysql.jdbc.Driver
otter.database.driver.url = jdbc:mysql://127.0.0.1:3306/otter
otter.database.driver.username = otter
otter.database.driver.password = otter

## otter communication port
otter.communication.manager.port = 1099

## default zookeeper address
otter.zookeeper.cluster.default = 192.168.40.37:2181
## default zookeeper sesstion timeout = 60s
otter.zookeeper.sessionTimeout = 60000

[root@wallet01 ~]# cd /usr/local/manager/bin
[root@wallet01 bin]# ./startup.sh

[root@wallet01 ~]# cd /usr/local/manager/logs
[root@wallet01 logs]# cat manager.log
2018-11-19 10:29:26.146 [] INFO  com.alibaba.otter.manager.deployer.OtterManagerLauncher - ## start the manager server.
2018-11-19 10:29:49.427 [] INFO  com.alibaba.otter.manager.deployer.JettyEmbedServer - ##Jetty Embed Server is startup!
2018-11-19 10:29:49.427 [] INFO  com.alibaba.otter.manager.deployer.OtterManagerLauncher - ## the manager server is running now ......


[root@wallet01 ~]# mkdir -p /usr/local/nodemkdir -p /usr/local/node
[root@wallet01 ~]# tar zxvf node.deployer-4.2.16.tar.gz -C /usr/local/node
[root@wallet01 ~]# cd /usr/local/node/conf/
[root@wallet01 conf]# echo 1 > nid

[root@wallet01 conf]# vi otter.properties 
## otter arbitrate & node connect manager config
otter.manager.address = 192.168.40.37:1099

[root@wallet01 ~]# cd /usr/local/node/bin
[root@wallet01 bin]# ./startup.sh

[root@wallet01 ~]# cd /usr/local/node/logs/node
[root@wallet01 node]# cat node.log 
2018-11-19 10:58:09.830 [main] INFO  com.alibaba.otter.node.deployer.OtterLauncher - INFO ## the otter server is running now ......



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章