当先锋百科网

首页 1 2 3 4 5 6 7

环境:系统--Ubuntu,Hadoop--已搭建

1. Zookerper3.4.6分布式

配置zoo.cfg:

  server.1=master:2888:3888
  server.2=slave1:2888:3888
  server.3=slave2:2888:3888

  dataDir=/tool/java/zookeeper-3.4.6/data

配置myid :

   各zk的myid的值与zoo.cfg的配置保持一致

通过scp传到各节点

启动各节点zkServer : bin/zkServer.sh start

# bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print

2.  Hadoop

  启动hdfs : srart-all.sh/start-dfs.sh

3. HBase

配置hbase-env.sh:
  export JAVA_HOME=jdk安装目录
  export HBASE_MANAGES_ZK=false

配置regionservers:
  slave1
  slave2

配置hbase-site.xml:

<configuration>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>master,slave1,slave2</value>
    <description>The directory shared by RegionServers. </description>
  </property>  
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/tool/java/zookeeper-3.4.6/data/</value>
    <description>Property from ZooKeeper's config zoo.cfg. The directory where the snapshot is stored. 是zk的dataDir</description>
  </property>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://master:8020/hbase</value>
    <description>The directory shared by RegionServers. 这里的8020端口是hdfs的连接端口</description>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
    <description>The mode the cluster will be in. Possible values are false: standalone and pseudo-distributed setups with managed Zookeeper
      true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
    </description>
  </property>
</configuration>

#Hadoop与Hbase版本需要注意

4. 启动

  bin/start-hbase.sh

  bin/hbase shell #连接hbase