叢集環境下配置hadoop,zookeeper,hbase第二部分
阿新 • • 發佈:2019-02-05
3.安裝zookeeper,修改配置檔案:
兩臺機器的zookeeper安裝路徑要相同,切記,切忌!!!
1)cp zoo_sample.cfg zoo.cfg
2)修改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=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
#...
#...
#...
server.1=master:2888:3888
server.2=slave:2888:3888
3)在master的/tmp/zookeeper路徑下增加myid檔案,內容為:1
4)在master的/tmp/zookeeper路徑下增加myid檔案,內容為:2
補充說明:如果要單獨使用zookeeper叢集伺服器,則使用zkServer.sh start命令分別啟動每個zookeeper節點
4.安裝hbase,修改配置檔案
1)修改:hbase_env.sh的兩個屬性:
# The java implementation to use. Java 1.6 required.
export JAVA_HOME=/opt/java
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true
2)在兩臺機器上的hadoop檔案系統中建立hbase目錄:
hadoop fs -mkdir hbase
3)修改master上的hbase-site.xml檔案:
<configuration>
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
<description>The directory shared by RegionServers.
</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave</value>
</property>
</configuration>
4)修改slave上的hbase-site.xml檔案:
<configuration>
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://slave:9000/hbase</value>
<description>The directory shared by RegionServers.
</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave</value>
</property>
</configuration>
5)修改regionservers檔案為:
master
slave
6)啟動hbase並測試:
start-hbase.sh
hbase shell
list
哈哈,完畢!
兩臺機器的zookeeper安裝路徑要相同,切記,切忌!!!
1)cp zoo_sample.cfg zoo.cfg
2)修改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=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
#...
#...
#...
server.1=master:2888:3888
server.2=slave:2888:3888
3)在master的/tmp/zookeeper路徑下增加myid檔案,內容為:1
4)在master的/tmp/zookeeper路徑下增加myid檔案,內容為:2
補充說明:如果要單獨使用zookeeper叢集伺服器,則使用zkServer.sh start命令分別啟動每個zookeeper節點
4.安裝hbase,修改配置檔案
1)修改:hbase_env.sh的兩個屬性:
# The java implementation to use. Java 1.6 required.
export JAVA_HOME=/opt/java
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=true
2)在兩臺機器上的hadoop檔案系統中建立hbase目錄:
hadoop fs -mkdir hbase
3)修改master上的hbase-site.xml檔案:
<configuration>
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/hbase</value>
<description>The directory shared by RegionServers.
</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave</value>
</property>
</configuration>
4)修改slave上的hbase-site.xml檔案:
<configuration>
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>hdfs://slave:9000/hbase</value>
<description>The directory shared by RegionServers.
</description>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count.
</description>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.master.port</name>
<value>60000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave</value>
</property>
</configuration>
5)修改regionservers檔案為:
master
slave
6)啟動hbase並測試:
start-hbase.sh
hbase shell
list
哈哈,完畢!