Environment to prepare

The server memory CPU system Network IP
k8s-master 4G 2 the nuclear Centos 7.6 192.168.0.6
k8s-node1 4G 2 the nuclear Centos 7.6 192.168.0.47
k8s-node2 4G 2 the nuclear Centos 7.6 192.168.0.154

Hadoop cluster has been installed. juejin.cn/post/691987…

Install the Zookeeper cluster

Download address

Zookeeper official website address zookeeper.apache.org/

Download address: mirror.bit.edu.cn/apache/zook… Download the -bin compiled compression package

Non - bin at the end of the package will be an error: Could not find or Load a main class org. Apache. The zookeeper. Server. Quorum. QuorumPeerMainCopy the code

The installation

CD/usr/local/bigdata wget HTTP: / / https://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz Gz mv apache-zookeeper-3.6.2 Zookeeper CD Zookeeper mkdir dataCopy the code

echo "1" >> data/myid

Official Website Configuration Examplehttps://zookeeper.apache.org/doc/current/zookeeperStarted.html

Modifying a Configuration File

cp zoo_sample.cfg 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 #  the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 ## Metrics Providers # # https://prometheus.io Metrics Exporter #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider #metricsProvider.httpPort=7000 #metricsProvider.exportJvmInfo=true ##the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database. dataDir=/usr/local/bigdata/zookeeper/data dataLogDir=/usr/local/bigdata/zookeeper/log server.1=k8s-master:2888:3888 server.2=k8s-node1:2888:3888 server.3=k8s-node2:2888:3888Copy the code

Run the Hbase SCP command to k8s-node1 k8s-node2 and change myID to 1 and 2

Zookeeper command

Sh start Start sh zkServer.sh stop Stop sh zkServer.sh status Check the statusCopy the code

Start the cluster

Sh zkserver. sh start Run the sh zkserver. sh status Client port found: 2181. Client address: localhost. Mode: The leader/follower interface is successfully started and the lsof -i:2181 process exists. If an error is encountered, Client port found: 2181. Check whether the names used by /etc/hosts and zoo. CFG are the same. If this error is made, k8s-master is incorrectly entered as ks-masterCopy the code

Use external ZooKeeper to install Hbase

Download address

Website address: hbase.apache.org/

Download address: mirror.bit.edu.cn/apache/hbas…

Selecting an Installation Directory

/ usr/local/bigdata/hbase mv hbase - 1.4.13 hbaseCopy the code

Modifying a Configuration File

Copy core-site. XML and HDFS-site. XML in Hadoop to the conf folder in the hbase installation directory and modify conf/hbase-env.shCopy the code

vi hbase-env.sh

Export JAVA_HOME=/usr/lib/ JVMS /java-1.8.0-openjdk # export HBASE_MANAGES_ZK=FALSECopy the code

vi hbase-site.xml

<configuration> <! Hbase. rootdir</name> <value> HDFS ://k8s-master:9000/hbase</value> </property> <! - specifies hbase is distributed - > < property > < name >. Hbase cluster. Distributed < / name > < value > true < value > / < / property > <! -- specify the zK address --> <property> <name>hbase.zookeeper.quorum</name> <value>k8s-master:2181,k8s-node1:2181,k8s-node2:2181</value> </property> </configuration>Copy the code

vi regionservers

k8s-node1
k8s-node2
Copy the code

Configuring Environment Variables

vi /etc/profile

export HBASE_HOME=/usr/local/bigdata/hbase
export PATH=$PATH:$HBASE_HOME/bin
Copy the code

source /etc/profile

Starting the hbase Cluster

In k8s - master perform in/usr/local/bigdata/hbase/bin directory Startup command: sh start - hbase. Sh terminate command: sh stop - hbase. ShCopy the code

Check whether the startup is successful

JPS is used on the three machines. HRegionServer k8s-master HMaster is deployed on the k8s-node1 and K8s-node2 machinesCopy the code

Appear: k8s-node2:2181 stat is not executed because it is not in the whitelist.

Solution: vi zoo. CFG Add: 4lw.com mangs. whitelist=* Restart the ZooKeeper browser to access :http://ip:16010/zk.jsp HBase is shared at/HBase Active master address: K8s - master, 16000161339901, 74, Backup master addresses: Region server holding hbase: meta: K8s rac-node1, 16020161339910 64 Region servers: K8s rac-node1, 16020161339910 64 k8s - 2, 16020161339910, 80 / hbase/replication: / hbase/replication/peers: / hbase/replication/rs: / hbase/replication/rs/k8s - 2, 16020161339910, 80: / hbase/replication/rs/k8s - node1, 16020161339910, 64: the Quorum Server Statistics: k8s - master: 2181 Zookeeper version: 3.6.1 track - 104 dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/2020 15:01 GMT Clients: / 192.168.0.6:52660 [1] (queued = 0, recved = 2, sent = 2) / 192.168.0.6:52664 [0] (queued = 0, recved = 1, sent = 0) Latency min/avg/Max: 0/0/0 Received: 4 Sent: 2 Connections: 2 Outstanding: 0 Zxid: 0x30000006D Mode: follower Node count: 43 k8s-node1:2181 Zookeeper version: 3.6.1 track - 104 dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/2020 15:01 GMT Clients: / 192.168.0.47:40666 [1] (queued = 0, recved = 1, sent = 1) / 192.168.0.6:46900 [0] (queued = 0, recved = 1, sent = 0) / 192.168.0.154:39822 [1] (queued = 0, recved = 2, sent = 2) / 192.168.0.47:40662 [1] (queued = 0, recved = 3, sent = 3) / 192.168.0.6:46890 [1] (queued = 0, recved = 2, sent = 2) / 192.168.0.6:46896 [1] (queued = 0, recved = 16, sent = 16) / 192.168.0.6:46888 [1] (queued = 0, recved = 2, sent = 2) / 192.168.0.154:39824 [1] (queued = 0, recved = 3, sent = 3) Latency min/avg/Max: 0/0.4545/3 Received: 30 Sent: 29 Connections: 8 Outstanding: 0 Zxid: 0x500000000 Mode: leader Node count: 43 Proposal sizes last/min/max: -1/-1/-1 k8s-node2:2181 Zookeeper version: 3.6.1 track - 104 dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/2020 15:01 GMT Clients: /192.168.0.6:46076[0](queued=0,recved=1,sent=0) Latency: 0/0.0/0 Received: 1 sent: 0 Connections: 1 Outstanding: 0 Zxid: 0x30000006d Mode: follower Node count: 43Copy the code

Panda Notebook Email:[email protected]