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

Hadoop+zookeeper+hbase boot self-startup

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Hadoop2.7.3+zookeeper3.4.9+hbase1.2.6

I want them to be self-booting, which requires 2 scripts. H2.sh and h3.sh.

#! / bin/bash

# discribe: realize hadoop+zookeeper+hbase boot self-startup

# links that are very useful to me: ssh to other machines to enable zk startup. Https://zhidao.baidu.com/question/1447196109490350780.html

I can use # while true, but I'm not familiar with it.

# Don't be afraid if there are villains in the way. Don't overcome the villain with your own ability, because you can't overcome it. You can go around by yourself. Or find someone else to overcome the villain.

# realize automatic boot, thanks to the link below, after you have solved the problem of switching users, continue to execute the following command. Http://www.jb51.net/article/59255.htm

# therefore, this script also needs to cooperate with the directory h2.sh script to complete the overall boot self-startup. The function of h2.sh is to execute this script after switching users.

The contents are as follows:

H3.sh:

While true

Do

For ip in master11 slave22 slave23

Do

Ping-c 5$ ip & > / dev/null & # without the & symbol, will always prompt. I can't give any other orders. & > / dev/null is also important.

If [$?-ne 0]; then

Tag=1

Echo $ip+ "NO kai ji"

Break

Else

Tag=0

Fi

Done

If [$tag-eq 0]; then

Break

Fi

Break # this is a difficult point. Its function is to jump out of the while loop. Avoid the endless cycle.

Done

/ usr/local/hadoop273/sbin/start-all.sh

[$?-eq 0] & & sleep 5 | | exit 1

For i in master11 slave22 slave23

Do

Ssh $I "/ home/hadoop/hadoop/zookeeper-3.4.9/bin/zkServer.sh start"

Done

# [$?-eq 0] & & / usr/local/hbase-1.2.6/bin/start-hbase.sh | | exit 2

If [$?-eq 0]; then

/ usr/local/hbase-1.2.6/bin/start-hbase.sh

Else

Echo "zk no ok"

Fi

H2.sh:

Su-hadoop-s / bin/bash / root/h3.sh.

Just put h2.sh under / etc/init.d/, and that's fine.

The script must have execute permission.

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

Database

Wechat

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

12
Report