Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Hadoop-zookeeper environment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to build a Hadoop-zookeeper environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1. Install JDK8 before installing zookeeper:

Rpm-ivh jdk-8u65-linux-x64.rpm

1.1. Configure environment variables:

Vim / etc/profile

JAVA_HOME=/usr/java/jdk1.8.0_65

CLASSPATH=$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH

Export JAVA_HOME CLASSPATH PATH

1.2.Configuring static IP address:

Vim / etc/sysconfig/network-scripts/ifcfg-eno16777736

1.3.Modification of mac address:

Vmware to view the virtual machine mac address:

Right-click-Settings-Network Adapter-Advanced-MAC address

Vim / etc/sysconfig/network-scripts/ifcfg-eno16777736

Add MACADDR=00:0C:29:36:97:20 (the mac address corresponding to the virtual machine)

Comment out the original HWADDR

: wq save exit.

Build a zk cluster:

Download address of zookeeper:

Http://www.apache.org/dyn/closer.cgi/zookeeper/

Download zookeeper to the local system:

Wget http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.8.tar.gz

Pwd: view the full path of the current directory

1. Decompress: tar-zxvf zookeeper-3.4.8.tar.gz

Copy the extracted file to / usr/local/

Cp-r zookeeper-3.4.8 / usr/local/

2. Copy the sample file:

Cp / usr/local/zookeeper-3.4.8/conf/zoo_sample.cfg / usr/local/zookeeper-3.4.8/conf/zoo.cfg

3. Modify zoo.cfg:

Vim zoo.cfg

Modify the data storage directory dataDir to:

DataDir=/usr/local/zookeeper-3.4.8/data

Configure 3 zk servers:

Add:

Server.1=server1:2888:3888

Server.2=server2:2888:3888

Server.3=server3:2888:3888

4. Create a data folder:

Mkdir / usr/local/zookeeper-3.4.8/data

5. Create a myid file under the data directory:

Vi myid-- > content is 1

There is a signifier 1, which represents server.1 server

6. Send files to other machines:

Scp zookeeper:

-r: copy directory-Q: do not show transfer progress

Scp-r zookeeper-3.4.8 root@192.168.0.108:/usr/local/

Yes

Enter password

Scp-rq zookeeper-3.4.8/ root@192.168.0.109:/usr/local/

7. Modify the myid file: (all three servers need to be modified)

Vim myid

Or

Echo 2 > / usr/local/zookeeper-3.4.8/data/myid

Edit the "myid" file and enter the corresponding number on the corresponding IP machine. For example, on server1, the content of the "myid" file is 1 (the myid content of multiple hosts is different, just be consistent with the zoo.cfg configuration file (server.*)).

8. Start the execution of zk:

Cd / usr/local/

Zookeeper-3.4.8/bin/zkServer.sh start (three machines should be started at the same time)

9. Check the zk status:

Zookeeper-3.4.8/bin/zkServer.sh status

Zookeeper-3.4.8/bin/zkServer.sh stop (stop)

An error was reported when viewing status:

Error contacting service. It is probably not running

Modify the hostname of zoo.cfg to the corresponding IP address:

Server.1=192.168.0.107:2888:3888

Server.2=192.168.0.108:2888:3888

Server.3=192.168.0.109:2888:3888

10. Enter the zk client:

Enter the Cli client of zookeeper:

Zookeeper-3.4.8/bin/zkCli.sh

Similar to the linux command:

Ls /

Help command:

Help

Create a node:

Create / path data

Ls / path

Get node data information:

Get / path [represents nodes, each node stores information]

Delete a node:

Delete / path

Ls /

Exit:

Quit

Go to the user folder:

Cd ~

Thank you for reading this article carefully. I hope the article "how to build a Hadoop-zookeeper Environment" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report