otter学习(1)—otter_manager 安装配置(快速开始)

时间:2021-07-24 22:42:22

一、环境准备

Zookeeper:192.168.134.128:2181
Mysql:192.168.134.129:3306
manager:192.168.134.133:8080

1、otter manager依赖于mysql进行配置信息的存储,所以需要预先安装mysql,并初始化otter manager的系统表结构
a. 安装mysql:[MySQL系列—服务器安装与配置](http://blog.csdn.net/u012758088/article/details/74906719)

b. 初始化otter manager系统表:
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget https://raw.github.com/alibaba/otter/master/manager/deployer/src/main/resources/sql/otter-manager-schema.sql

[root@localhost src]# service mysqld start
Starting MySQL..... SUCCESS! 

[root@localhost src]# /usr/local/mysql/bin/mysql -uroot -p888888

mysql> source /usr/local/src/otter-manager-schema.sql
2、整个otter架构依赖了zookeeper进行多节点调度,所以需要预先安装zookeeper,不需要初始化节点,otter程序启动后会自检
a. manager需要在otter.properties中指定一个就近的zookeeper集群机器

二、下载并解压 otter manager

直接下载 ,可访问:https://github.com/alibaba/otter/releases ,会列出所有历史的发布版本包下载方式。

[root@localhost /]# cd /usr/local/src/
[root@localhost src]# wget https://github.com/alibaba/otter/releases/download/v4.2.14/manager.deployer-4.2.14.tar.gz
[root@localhost src]# mkdir /usr/local/manager
[root@localhost src]# tar zxvf manager.deployer-4.2.13.tar.gz -C /usr/local/manager/

三、配置修改

[root@localhost manager]# vim conf/otter.properties 

## otter manager domain name,修改为正确访问ip,生成URL使用
otter.domainName = 192.168.134.133
## otter manager http port
otter.port = 8080
## 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.134.129:3306/otter
otter.database.driver.username = root
otter.database.driver.password = 888888

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

## otter communication pool size
otter.communication.pool.size = 10

## default zookeeper address,修改为正确的地址,手动选择一个地域就近的zookeeper集群列表
otter.zookeeper.cluster.default = 192.168.134.128:2181
## 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

四、准备启动

[root@localhost manager]# ./bin/startup.sh 

五、查看日志

[root@localhost manager]# vim logs/manager.log 

2017-12-14 13:01:55.360 [] INFO  com.alibaba.otter.manager.deployer.OtterManagerLauncher - ## start the manager server.
2017-12-14 13:04:20.766 [] INFO  com.alibaba.otter.manager.deployer.JettyEmbedServer - ##Jetty Embed Server is startup!
2017-12-14 13:04:20.929 [] INFO  com.alibaba.otter.manager.deployer.OtterManagerLauncher - ## the manager server is running now ......

出现类似日志,代表启动成功。

注意:一定要多等一会,从打印的日志可以看出,启动过程持续的3-4分钟。

六、验证

访问: http://192.168.134.133:8080,出现otter的页面,即代表启动成功。
otter学习(1)—otter_manager 安装配置(快速开始)
访问:http://192.168.134.133:8080/login.htm,初始密码为:admin/admin,即可完成登录. 目前:匿名用户只有只读查看的权限,登录为管理员才可以有操作权限。


附:配置过程中的问题

启动的过程中出现以下错误
Caused by: com.google.common.collect.ComputationException: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 60000
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:167) ~[guava-r08.jar:na]
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:116) ~[guava-r08.jar:na]
        at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:67) ~[guava-r08.jar:na]
        at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:623) ~[guava-r08.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient.getInstance(ZooKeeperClient.java:61) ~[shared.arbitrate-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient.getInstance(ZooKeeperClient.java:54) ~[shared.arbitrate-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent.<init>(ChannelArbitrateEvent.java:64) ~[shared.arbitrate-4.2.13.jar:na]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
        ... 55 common frames omitted
Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 60000
        at com.alibaba.otter.shared.common.utils.zookeeper.ZkClientx.connect(ZkClientx.java:974) ~[shared.common-4.2.13.jar:na]
        at com.alibaba.otter.shared.common.utils.zookeeper.ZkClientx.<init>(ZkClientx.java:104) ~[shared.common-4.2.13.jar:na]
        at com.alibaba.otter.shared.common.utils.zookeeper.ZkClientx.<init>(ZkClientx.java:98) ~[shared.common-4.2.13.jar:na]
        at com.alibaba.otter.shared.common.utils.zookeeper.ZkClientx.<init>(ZkClientx.java:86) ~[shared.common-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient.createClient(ZooKeeperClient.java:86) ~[shared.arbitrate-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient.access$000(ZooKeeperClient.java:38) ~[shared.arbitrate-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient$1.apply(ZooKeeperClient.java:45) ~[shared.arbitrate-4.2.13.jar:na]
        at com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient$1.apply(ZooKeeperClient.java:42) ~[shared.arbitrate-4.2.13.jar:na]
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:155) ~[guava-r08.jar:na]
        ... 66 common frames omitted

网上有好多解决方法,试了试都没用。仔细看看错误日志,错误好像和JDK的版本有关,换成了 JDK 6 之后,启动成功。