通过源码部署Mesos集群

对于Mesos集群(单节点)安装通过源代码编译的方式安装,对于操作系统的选型在这里使用Centos7进行部署:(主要部署Mesos软件、Zookeeper软件、Marathon软件并通过主从节点方式及调用端口API进行通信)

1.部署可以参考官方说明:http://mesos.apache.org/gettingstarted/There are different ways you can get Mesos:1. Download the latest stable release from Apache (Recommended)$ wget http://www.apache.org/dist/mesos/1.3.0/mesos-1.3.0.tar.gz$ tar -zxf mesos-1.3.0.tar.gz2. Clone the Mesos git repository (Advanced Users Only)$ git clone https://git-wip-us.apache.org/repos/asf/mesos.git3.对于Centos7操作系统需要注意如下配置:# Install a few utility tools$ sudo yum install -y tar wget git# Fetch the Apache Maven repo file.$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo# Install the EPEL repo so that we can pull in 'libserf-1' as part of our# subversion install below.$ sudo yum install -y epel-release# 'Mesos > 0.21.0' requires 'subversion > 1.8' devel package,# which is not available in the default repositories.# Create a WANdisco SVN repo file to install the correct version:$ sudo bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo

# Run test suite.

$ make check

# Install (Optional).

$ make install

5.上面部署完成后可以通过单节点方式测试一下单台部署情况(有多少个节点重复上面动作)。

# Change into build directory.

$ cd build

# Start Mesos master (ensure work directory exists and has proper permissions).

$ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos

# Start Mesos agent (ensure work directory exists and has proper permissions).

$ ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos

# Visit the Mesos web page.

$ http://127.0.0.1:5050

# Run C++ framework (exits after successfully running some tasks).

$ ./src/test-framework --master=127.0.0.1:5050

# Run Java framework (exits after successfully running some tasks).

$ ./src/examples/java/test-framework 127.0.0.1:5050

# Run Python framework (exits after successfully running some tasks).

$ ./src/examples/python/test-framework 127.0.0.1:5050

对于mesos源码安装后,通过 /usr/local/sbin/mesos-start-cluster.sh 启动集群(此步骤应该在zookeeper安装完成后)

修改配置文件(如果不存在需新建)/usr/local/etc/mesos/masters(slaves) 添加节点信息

6.在这里再介绍一下zookeeper(这里下载二进制包,也可以使用源码编译),用于高可用Mesos管理节点自动选择与监听,保证在某一台服务器DOWN后能够快速切换。

vi /Mesos/zookeeper/zookeeper-3.4.10/conf/zoo.cnf

tickTime=2000

dataDir=/Mesos/zookeeper/zookeeper-3.4.10/data

dataLogDir=/Mesos/zookeeper/zookeeper-3.4.10/logs

clientPort=2181

initLimit=5

syncLimit=2

server.1=master:2888:3888

server.2=slave01:2888:3888

server.3=slave02:2888:3888

echo "1" >/Mesos/zookeeper/zookeeper-3.4.10/data/myid

echo "2" >/Mesos/zookeeper/zookeeper-3.4.10/data/myid

echo "3" >/Mesos/zookeeper/zookeeper-3.4.10/data/myid

cat /etc/mesos/zk

zk://10.10.10.6:2181,10.10.10.7:2181,10.10.10.8:2181/mesos

echo 10.10.10.6 | tee /etc/mesos-master/ip

echo 10.10.10.6 | tee /etc/mesos-master/hostname

echo 10.10.10.6 | tee /etc/mesos-slave/ip

echo 10.10.10.6 | tee /etc/mesos-slave/hostname

echo 2 > /etc/mesos-master/quorum

7.启动基于Mesos集群服务的marathon服务用于对容器监控及部署

cd /Mesos/marathon/marathon-1.4.3/bin/

以下命令在单台使用,如果保证高可靠性需要在每台节点输入如下命令

./bin/start --master zk://10.10.10.6:2181,10.10.10.7:2181,10.10.10.8:2181/mesos  --zk zk://10.10.10.6:2181,10.10.10.7:2181,10.10.10.8:2181/marathon

你可能感兴趣的:(通过源码部署Mesos集群)