国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Docker創建的集群下使用ansible部署zookeeper

Yumenokanata / 2193人閱讀

摘要:使用文章創建的集群下使用部署中創建的集群進行的安裝在上制作安裝包下載官方源下載顯得十分緩慢,所以還是選擇國內的鏡像源,將下載到創建鏈接下載完成后將解壓并創建鏈接,方便管理修改配置文件中已經提供了配置模板,復制一份

使用文章“Docker創建的集群下使用ansible部署hadoop”中創建的集群進行zookeeper的安裝

OS hostname IP
Centos7 cluster-master 172.18.0.2
Centos7 cluster-slave1 172.18.0.3
Centos7 cluster-slave1 172.18.0.4
Centos7 cluster-slave1 172.18.0.5
在cluster-master上制作zookeeper安裝包 下載

官方源下載顯得十分緩慢,所以還是選擇國內的鏡像源,將zookeeper下載到/opt

[root@cluster-master opt]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/zookeeper-3.4.10.tar.gz
創建鏈接

下載完成后將zookeeper-3.4.10.tar.gz解壓并創建鏈接,方便管理

[root@cluster-master opt]# tar -zxvf zookeeper-3.4.10.tar.gz
[root@cluster-master opt]# ln -s zookeeper-3.4.10 zookeeper
修改配置文件

/opt/zookeeper/conf中已經提供了zoo_sample.cfg配置模板,復制一份zoo.cfg進行修改即可使用,我的配置項如下:
[root@cluster-master conf]# cp zoo_sample.cfg zoo.cfg
[root@cluster-master conf]# vi zoo.cfg

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/zookeeper/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

server.2=172.18.0.2:2888:3888
server.3=172.18.0.3:2888:3888
server.4=172.18.0.4:2888:3888
server.5=172.18.0.5:2888:3888

dataDir做了從新定義,server項使用IP的最后一位,也是為了方便管理

創建shell腳本,完成安裝步驟

在/opt/zookeeper下新建postinstall.sh創建dataDir目錄和myid文件,并寫入zoo.cfg中定義的myid值

vi /opt/zookeeper/postinstall.sh

#!/bin/bash

# zookeeper conf file
conf_file="/opt/zookeeper/conf/zoo.cfg"
# get myid
IP=$(/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6 |
     awk "{print $2}")
ID=$(grep ${IP} ${conf_file}|cut -d = -f 1|cut -d . -f 2)

# get dataDir
dataDir=$(grep dataDir ${conf_file}|grep -v "^#"|cut -d = -f 2)

# create dataDir and myid file
mkdir -p ${dataDir}
:>${dataDir}/myid
echo ${ID} > ${dataDir}/myid
打包配置完成后的zookeeper,準備上傳至slave主機

將鏈接zookeeper和目錄zookeeper-3.4.10打包并壓縮

[root@cluster-master opt]# tar -zcvf zookeeper-dis.tar.gz zookeeper zookeeper-3.4.10
創建yaml,安裝zookeeper
[root@cluster-master opt]# vi install-zookeeper.yaml
---
- hosts: slaves
  tasks:
    - name: install ifconfig
      yum: name=net-tools state=latest
    - name: unarchive zookeeper
      unarchive: src=/opt/zookeeper-dis.tar.gz dest=/opt
    - name: postinstall
      shell: bash /opt/zookeeper/postinstall.sh
分發安裝文件到slave主機
[root@cluster-master opt]# ansible-playbook install-zookeeper.yaml
啟動zookeeper

此時,zookeeper集群已經可以正常啟動

[root@cluster-master opt]# ansible cluster -m command -a "/opt/zookeeper/bin/zkServer.sh start"
查看狀態
[root@cluster-master bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Mode: follower
運行客戶端
[root@cluster-master bin]# ./zkCli.sh -server localhost:2181
Connecting to localhost:2181
2017-08-29 18:05:36,078 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2017-08-29 18:05:36,091 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=cluster-master
2017-08-29 18:05:36,091 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_141
2017-08-29 18:05:36,098 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2017-08-29 18:05:36,098 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64/jre
2017-08-29 18:05:36,098 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/opt/zookeeper/bin/../build/classes:/opt/zookeeper/bin/../build/lib/*.jar:/opt/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/opt/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/zookeeper/bin/../lib/jline-0.9.94.jar:/opt/zookeeper/bin/../zookeeper-3.4.10.jar:/opt/zookeeper/bin/../src/java/lib/*.jar:/opt/zookeeper/bin/../conf:
2017-08-29 18:05:36,099 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2017-08-29 18:05:36,100 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2017-08-29 18:05:36,100 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=
2017-08-29 18:05:36,100 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2017-08-29 18:05:36,100 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2017-08-29 18:05:36,100 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=3.10.0-514.26.2.el7.x86_64
2017-08-29 18:05:36,101 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2017-08-29 18:05:36,101 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2017-08-29 18:05:36,101 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/opt/zookeeper-3.4.10/bin
2017-08-29 18:05:36,124 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@25f38edc
2017-08-29 18:05:36,205 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
JLine support is enabled
2017-08-29 18:05:36,730 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2017-08-29 18:05:36,795 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x25e2f22aa660001, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 1] 
總結

使用到了之前創建的集群和ansible,發現使用ansible部署應用確實很方便。

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/27013.html

相關文章

  • Docker創建集群使用ansible部署hbase

    摘要:基于安裝好的和集群部署創建的集群下使用部署創建的集群下使用部署在上制作安裝包下載創建目錄,并將軟件包現在到這個目錄,依然使用國內鏡像下載。部署使用執行完成的部署工作。 基于安裝好的hadoop和zookeeper集群部署hbase Docker創建的集群下使用ansible部署hadoop Docker創建的集群下使用ansible部署zookeeper OS hostname...

    siberiawolf 評論0 收藏0
  • 技術干貨 | 初次微服務體驗:從Docker容器農場說起

    摘要:或許你的第一次微服務體驗,就從本文開始在本文中,和等紛紛亮相,并配有詳細的代碼說明。該角色與本地網絡及的配置設置相關。由于會在虛擬機初始化過程中自動執行配置任務,因此惟一的解決辦法就是將相關內容提取至單獨的劇本當中 這是一篇溫和有趣的技術文章,如果你初識Docker,對微服務充滿興趣,不妨一讀。或許你的第一次微服務體驗,就從本文開始…… 在本文中,Mesos、Zookeeper、Ma...

    魏憲會 評論0 收藏0
  • 數人云工程師手記 | 雙劍合璧,分布式部署兩步走

    摘要:今天小數給大家帶來的是數人云工程師金燁的分享,有關于自動快速部署服務相關組件的一些實踐。當與相遇,雙劍合璧,一切變得如此簡單有趣。通過將服務注冊到來做健康檢查。 今天小數給大家帶來的是數人云工程師金燁的分享,有關于自動快速部署DCOS服務相關組件的一些實踐。當Ansible與Docker相遇,雙劍合璧,一切變得如此簡單有趣。 本次分享將包括以下內容: 云平臺部署使用的服務、組件 Do...

    Jonathan Shieber 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<