您好,登錄后才能下訂單哦!
一、zookeeper
1、/etc/profile
HADOOP_PREFIX=/opt/hadoop
JAVA_HOME=/opt/jdk18
ZOOKEEPER_HOME=/opt/zookeeper
HBASE_HOME=/opt/hbase
PATH=$PATH:$JAVA_HOME/bin:$HADOOP_PREFIX/bin:$HADOOP_PREFIX/sbin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin
export HADOOP_PREFIX PATH JAVA_HOME ZOOKEEPER_HOME HBASE_HOME USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
2、創建目錄:
mkdir -p /opt/zookeeper/data
mkdir -p /opt/zookeeper/logs
3、修改zoo.cfg配置文件,在在文件末尾添加。
server.1=NameNode34:2888:3888
server.2=DataNode35:2888:3888
server.3=DataNode37:2888:3888
server.4=DataNode38:2888:3888
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/logs
4、創建myid文件
在dataDir目錄下創建myid文件,該文件的內容根據server定義的不同而不同,如server.1 該文件的內容是1,server.2 該文件內容是 2,以此類推.
節點1
echo "1">myid
節點2
echo "2">myid
節點3
echo "3">myid
節點4
echo "4">myid
5、拷貝至其他節點
scp /etc/profile root@DataNode35:/etc/profile
scp /etc/profile root@DataNode37:/etc/profile
scp /etc/profile root@DataNode38:/etc/profile
scp -r /opt/zookeeper root@DataNode35:/opt
scp -r /opt/zookeeper root@DataNode37:/opt
scp -r /opt/zookeeper root@DataNode38:/opt
6、在每個節點上
source /etc/profile
7、在每個節點上執行 zkServer.sh start
JMX enabled by default
Using config: /usr1/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
1.8 驗證
[hadoop1@node4 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /usr1/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[hadoop1@node1 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /usr1/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[hadoop1@node2 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /usr1/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[hadoop1@node3 bin]$ ./zkServer.sh status
JMX enabled by default
Using config: /usr1/zookeeper/bin/../conf/zoo.cfg
Mode: follower
-- The End --
二、hbase
1、下載hbase
2、/etc/profile
HADOOP_PREFIX=/opt/hadoop
JAVA_HOME=/opt/jdk18
ZOOKEEPER_HOME=/opt/zookeeper
HBASE_HOME=/opt/hbase
PATH=$PATH:$JAVA_HOME/bin:$HADOOP_PREFIX/bin:$HADOOP_PREFIX/sbin:$ZOOKEEPER_HOME/bin:$HBASE_HOME/bin
export HADOOP_PREFIX PATH JAVA_HOME ZOOKEEPER_HOME HBASE_HOME USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
3、修改配置文件/opt/hbase/conf/hbase-env.sh
export JAVA_HOME=/opt/jdk18/
export HBASE_CLASSPATH=/opt/hbase/conf
export HBASE_MANAGES_ZK=true
4、在hbase安裝目錄下建立tmp文件夾
mkdir tmp
5、修改hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://NameNode34:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>/opt/hbase/tmp</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>NameNode34,DataNode35,DataNode37,DataNode38</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/opt/hbase/tmp/zookeeper</value>
</property>
</configuration>
6、編輯/opt/hbase/conf/regionservers,將所有的slavenode添加到這個文件
NameNode34
DataNode35
DataNode37
DataNode38
7、將Hbase拷貝到其他節點機并對其他節點機配置環境變量
scp /etc/profile root@DataNode35:/etc/profile
scp /etc/profile root@DataNode37:/etc/profile
scp /etc/profile root@DataNode38:/etc/profile
scp -r /opt/hbase root@DataNode35:/opt
scp -r /opt/hbase root@DataNode37:/opt
scp -r /opt/hbase root@DataNode38:/opt
8、在每個節點上
source /etc/profile
9、在主節點啟動hbase(只在主節點啟動就OK)
start-hbase.sh
10、驗證hbase
jps
11、測試hbase shell
hbase shell
Create ‘test’,’data’
Disable ‘test’
Dorp ‘test’
參考:
zookeeper:
http://blog.chinaunix.net/uid-77311-id-4580114.html
hbase:
http://blog.itpub.net/28929558/viewspace-1204409
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。