【发布时间】:2016-02-01 09:49:45
【问题描述】:
我有以下设置 - 4 个名为 master、box01、box02、box03 的 CentOS 7.0 虚拟机。
master虚拟机有:mesos-master、mesos-slave
box01 : mesos-master, mesos-slave, zkServer
box02 : mesos-master, mesos-slave, zkServer
box03 : mesos-slave, zkServer
每当我在没有启动 zookeeper 的情况下在集群上运行 mesos 框架时,一切都运行良好。但是,当我部署并启动 zookeeper 集群时,我运行的框架只有在框架是从作为 ACTIVE mesos master 的同一台机器上运行时才会完成。
例如I have the elected master to be at box01.如果我从 box01 运行一个框架,它会很好地完成。如果我从主框运行它,我会在客户端收到以下日志,并且它永远不会继续:
I1101 13:56:11.997733 5384 sched.cpp:164] Version: 0.24.0
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@712: Client environment:zookeeper.version=zookeeper C client 3.4.5
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@716: Client environment:host.name=master.localdomain
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@723: Client environment:os.name=Linux
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@724: Client environment:os.arch=3.10.0-229.el7.x86_64
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@725: Client environment:os.version=#1 SMP Fri Mar 6 11:36:42 UTC 2015
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@733: Client environment:user.name=root
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@741: Client environment:user.home=/root
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@log_env@753: Client environment:user.dir=/home/user/download
2015-11-01 13:56:12,011:5383(0x7f55fee16700):ZOO_INFO@zookeeper_init@786: Initiating client connection, host=box01:2181,box02:2181,box03:2181 sessionTimeout=10000 watcher=0x7f560236e6d4 sessionId=0 sessionPasswd=<null> context=0x7f5604003c50 flags=0
2015-11-01 13:56:12,018:5383(0x7f55fd613700):ZOO_INFO@check_events@1703: initiated connection to server [10.0.0.11:2181]
2015-11-01 13:56:12,025:5383(0x7f55fd613700):ZOO_INFO@check_events@1750: session establishment complete on server [10.0.0.11:2181], sessionId=0x150c2c9ffc6002d, negotiated timeout=10000
I1101 13:56:12.027992 5398 group.cpp:331] Group process (group(1)@10.0.0.10:35217) connected to ZooKeeper
I1101 13:56:12.028153 5398 group.cpp:805] Syncing group operations: queue size (joins, cancels, datas) = (0, 0, 0)
I1101 13:56:12.028198 5398 group.cpp:403] Trying to create path '/mesos' in ZooKeeper
I1101 13:56:12.036267 5398 detector.cpp:156] Detected a new leader: (id='11')
I1101 13:56:12.037309 5398 group.cpp:674] Trying to get '/mesos/json.info_0000000011' in ZooKeeper
I1101 13:56:12.041631 5398 detector.cpp:481] A new leading master (UPID=master@10.0.0.11:5050) is detected
I1101 13:56:12.042068 5398 sched.cpp:262] New master detected at master@10.0.0.11:5050
I1101 13:56:12.043937 5398 sched.cpp:272] No credentials provided. Attempting to register without authentication
我们可以看到客户端成功发现 10.0.0.11(box01) 是代理主机。如果此时我杀死了代理 mesos 主节点(box01),则会发生新的选举,并且由于存在 2 的法定人数(主节点和 box03 框),将选举一个新的主节点。如果这个 master 是 master 框,那么框架将成功完成任务。如果是box03,客户端会发现这是master,然后再次挂起。对此应该有一个简单的解释,但此时我似乎无法摆脱我的思考框。请帮忙。
我正在使用 mesos-0.24.0、zookeeper-3.4.6。
zookeeper-3.4.6/conf/zoo.cfg
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=box01:2888:3888
server.2=box02:2888:3888
server.3=box03:2888:3888
/etc/hosts 文件
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.10 master master.localdomain
10.0.0.11 box01 box01.localdomain
10.0.0.12 box02 box02.localdomain
10.0.0.13 box03 box03.localdomain
在每台机器上的防火墙设置是:
--firewall-cmd --list-ports
5051/tcp 3888/tcp 2181/tcp 2888/tcp 5050/tcp
要启动 mesos-master 我使用:
/home/user/download/mesos-0.24.0/build/bin/mesos-master.sh --ip=10.0.0.10 --work_dir=/home/user/download/data-mesos --zk=zk://box01:2181,box02:2181,box03:2181/mesos --quorum=2
要启动 mesos-slave 我使用:
/home/user/download/mesos-0.24.0/build/bin/mesos-slave.sh --master=zk://box01:2181,box02:2181,box03:2181/mesos
编辑:
事实证明,如果我在 box02(10.0.0.12) 上运行独立 mesos master 并尝试从 master(10.0.0.10) 框中运行框架,mesos master 会收到框架运行请求作业,但是它没有被执行
主盒框架日志
[root@master ~]# java -Djava.library.path=/usr/local/lib -jar /home/user/download/test-framework/example-framework-1.0-SNAPSHOT-jar-with-dependencies.jar box02:5050
I1103 13:44:21.898962 20958 sched.cpp:164] Version: 0.24.0
I1103 13:44:21.910660 20972 sched.cpp:262] New master detected at master@10.0.0.12:5050
I1103 13:44:21.913422 20972 sched.cpp:272] No credentials provided. Attempting to register without authentication
因此,zookeeper 似乎与问题无关,而是由于某种原因,master 无法将任何内容发送回执行框架的机器(mesos 调度程序)。
【问题讨论】:
-
拥有主日志(来自故障转移和接管主)和框架日志将有助于对问题进行分类。
-
框架日志是我原帖的第一段代码。我将在今天晚些时候提供两位大师的日志。
-
我编辑了原始问题。
-
我还是看不到活动master的日志。可以附上吗?
-
box02 是活动主机。 This is the log。该框架由另一个称为“master”的框执行。很抱歉设置混乱。
标签: apache-zookeeper centos7 mesos