Zookeeper集羣搭建(簡單)(29)

1    搭建zookeeper的集羣java

1.1    zookeeper集羣要求至少3個節點(hadoop0,hadoop1,hadoop2)(第27章hadoop集羣搭建),且是奇數個,且節點之間的時間要同步。ssh

1.2    在hadoop0上對zookeeper.tar.gz進行復制,解壓縮、重命名、設置環境變量.oop

        (1)複製zookeeper-3.4.tar.gz到/usr/local目錄,而後進入到該目錄
server

        (2)執行命令tar -zxvf    zookeeper-3.4.tar.gz進行解壓縮
進程

        (3)重命名mv zookeeper-3.4     zookeeper
hadoop

1.3    在hadoop0上進入zookeeper的conf目錄同步

            mv    zoo_sample.cfg    zoo.cfg
集羣

1.4    在hadoop0上進入/usr/local/zookeeper/conf目錄下,進行編輯文件zoo.cfg,變量

        修改dataDir=/tmp/zookeeper    改爲data=/usr/local/zookeeper/data
zookeeper

        新增如下三行:

                    server.0=hadoop0:2888:3888

                    server.1=hadoop1:2888:3888

                    server.2=hadoop2:2888:3888

        在hadoop0上建立文件夾,執行命令mkdir    -p    /usr/local/zookeeper/data

1.5    在hadoop0的data目錄下,建立文件myid,文件內容是0

1.6    把hadoop0上的zookeeper文件夾和/etc/profile複製到hadoop1,hadoop2節點.

1.7    在hadoop1上執行source /etc/profile,修改myid的值爲1

         在hadoop2上執行source /etc/profile,修改myid的值爲2

1.8    分別ssh到三個節點,在三個分別執行命令zkServer.sh    start

1.9    驗證:在各個節點分別執行jps,發現多一個java進程是QuorumPeerMain. 

                                                                                                        

                                                                                                                Name:Xr

                                                                                                                Date:2014-3-30 20:31

相關文章
相關標籤/搜索