{"id":55,"date":"2024-06-26T14:47:56","date_gmt":"2024-06-26T06:47:56","guid":{"rendered":"https:\/\/abytelalala.cn\/?p=55"},"modified":"2024-07-03T20:11:51","modified_gmt":"2024-07-03T12:11:51","slug":"%e5%9f%ba%e4%ba%8eubuntudocker%e6%90%ad%e5%bb%bahadoop%ef%bc%8czookeeper%ef%bc%8chbase","status":"publish","type":"post","link":"https:\/\/abytelalala.cn\/index.php\/2024\/06\/26\/%e5%9f%ba%e4%ba%8eubuntudocker%e6%90%ad%e5%bb%bahadoop%ef%bc%8czookeeper%ef%bc%8chbase\/","title":{"rendered":"\u57fa\u4e8eubuntu,docker\u642d\u5efahadoop\uff0czookeeper\uff0chbase"},"content":{"rendered":"\n<p>\u5982\u679c\u524d\u9762\u6ca1\u642d\u5efadocker\uff0c\u8be6\u60c5\u8bf7\u770b\u8fd9\u7bc7\u6587\u7ae0\uff1a<a href=\"https:\/\/abytelalala.cn\/index.php\/2024\/06\/24\/ubentu%e4%bb%8e%e9%9b%b6%e5%bc%80%e5%a7%8b%e9%83%a8%e7%bd%b2docker\/\">https:\/\/abytelalala.cn\/index.php\/2024\/06\/24\/ubentu%e4%bb%8e%e9%9b%b6%e5%bc%80%e5%a7%8b%e9%83%a8%e7%bd%b2docker\/<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/docker\/daemon.json\n\u5199\u5165\u5982\u4e0b\u4e09\u884c\u5185\u5bb9\n{\n  \"registry-mirrors\": &#91;\"https:\/\/docker.foreverlink.love\/\"]\n}\n\nservice docker restart\ndocker info\/\/\u9a8c\u8bc1\u6210\u529f\u66ff\u6362\u6210\u529f\u6ca1\u6709\ndocker pull ubuntu:latest\n\ndocker run -it ubuntu:latest\n\napt-get update\napt update\napt upgrade<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">net-tools<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install net-tools<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">java<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install openjdk-8-jdk<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b89\u88c5\u5305<\/h2>\n\n\n\n<p>\u4e0b\u8f7d\u5b89\u88c5\u5305<br>hadoop-3.2.2.tar.gz\uff0c<br>hbase-2.5.8-bin.tar.gz\uff0c<br>apache-zookeeper-3.7.2-bin.tar.gz<br>\u62d6\u52a8\u5230mobaXterm\u7684\u865a\u62df\u673a\u9875\u9762\u76ee\u5f55<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u538b\u79fb\u52a8\u7b49\u64cd\u4f5c<\/h2>\n\n\n\n<p>\u63a5\u4e0b\u6765\u64cd\u4f5c\u9700\u8981\u518d\u5f00\u4e00\u4e2a\u65b0\u7ec8\u7aef\uff0c\u4fdd\u7559\u4e4b\u524d\u7684\u7ec8\u7aef<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su -\ndocker ps \/\/\u67e5\u770b\u6307\u5b9a\u7684\u5bb9\u5668id\ndocker cp \/home\/cust\/hadoop-3.2.2.tar.gz &lt;\u6307\u5b9a\u5bb9\u5668id&gt;:\/usr\/local\/ \/\/\u79fb\u52a8\u5230docker\u91cc\ndocker cp \/home\/cust\/hbase-2.5.8-bin.tar.gz &lt;\u6307\u5b9a\u5bb9\u5668id&gt;:\/usr\/local\/\ndocker cp \/home\/cust\/apache-zookeeper-3.7.2-bin.tar.gz &lt;\u6307\u5b9a\u5bb9\u5668id&gt;:\/usr\/local\/ \/\/\u8fd9\u4e24\u4e2a\u90fd\u540c\u7406<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u8fdb\u5165\u539f\u5bb9\u5668\u7684\u7ec8\u7aef\uff0c\u8f93\u5165\u5982\u4e0b\u547d\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/local\nls\n\/\/\u67e5\u770b\u662f\u5426\u8f6c\u79fb\u5230\u8fd9\u91cc\u6765\u4e86\n\ntar -zxvf hadoop-3.2.2.tar.gz\nmv hadoop-3.2.2 \/usr\/local\/hadoop\ntar -zxvf apache-zookeeper-3.7.2-bin.tar.gz\nmv apache-zookeeper-3.7.2-bin \/usr\/local\/zookeeper\ntar -zxvf hbase-2.5.8-bin.tar.gz\nmv hbase-2.5.8 \/usr\/local\/hbase \/\/\u5177\u4f53\u4f60\u4eec\u6587\u4ef6\u89e3\u538b\u540e\u662f\u4ec0\u4e48\u540d\u5b57\uff0c\u5177\u4f53\u7528ls\u547d\u4ee4\u6765\u67e5\u770b\u4fee\u6539\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6dfb\u52a0\u73af\u5883\u53d8\u91cf<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install nano\nnano \/etc\/profile<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5728\/etc\/profile\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64\nHADOOP_HOME=\/usr\/local\/hadoop\nexport PATH=$JAVA_HOME\/bin:$PATH\nexport PATH=$PATH:$HADOOP_HOME\/bin:$HADOOP_HOME\/sbin\n#root\u542f\u52a8\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u73af\u5883\nexport HDFS_NAMENODE_USER=root\nexport HDFS_DATANODE_USER=root\nexport HDFS_SECONDARYNAMENODE_USER=root\nexport YARN_RESOURCEMANAGER_USER=root\nexport YARN_NODEMANAGER_USER=root\nexport ZOOKEEPER_HOME=\/usr\/local\/zookeeper\nexport PATH=$PATH:$ZOOKEEPER_HOME\/bin\nexport HBASE_HOME=\/usr\/local\/hbase\nexport PATH=$PATH:$HBASE_HOME\/bin<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">ssh\u514d\u5bc6\u767b\u5165<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update\napt-get install systemd\napt-get update --fix-missing\napt-get install openssh-server\nssh-keygen -t rsa \/\/\u9047\u89c1\u8f93\u5165\u5bc6\u7801\u4ec0\u4e48\u7684\u90fd\u56de\u8f66\ncat ~\/.ssh\/id_rsa.pub &gt;&gt; ~\/.ssh\/authorized_keys\n\nservice ssh start\nservice ssh status\n\/\/\u68c0\u67e5\u4e00\u4e0bsshd\u662f\u5426\u5f00\u542f\nssh localhost\n\/\/\u8fd0\u884c\u5b8c\u6210\u4f1a\u5f39\u51fa\u4e00\u4e2a\u95ee\u4f60\u7b2c\u4e00\u6b21\u767b\u9646\u662f\u5426\u7684\u95ee\u9898\n\/\/\u4f60\u8981\u56de\u7b54yes\uff0c\u4e0d\u8981\u53ea\u56de\u7b54\u4e00\u4e2ay<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">hadoop\u914d\u7f6e\u6587\u4ef6<\/h2>\n\n\n\n<p>\u5728\/usr\/local\/hadoop\/etc\/hadoop\/\u6587\u4ef6\u5939\u4e0b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">hadoop-env.sh\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\u52a0\u5165\uff1a<br>\u200b<br># \u663e\u5f0f\u58f0\u660ejava\u8def\u5f84<br>export JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">core-site.xml\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;configuration&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;fs.defaultFS&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;hdfs:\/\/hadoop01:9000&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;!-- \u6307\u5b9ahadoop\u8fd0\u884c\u65f6\u4ea7\u751f\u6587\u4ef6\u7684\u5b58\u50a8\u8def\u5f84 --&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hadoop.tmp.dir&lt;\/name&gt;<br> &nbsp;      &lt;!-- \u914d\u7f6e\u5230hadoop\u76ee\u5f55\u4e0btemp\u6587\u4ef6\u5939 --&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;file:\/usr\/local\/hadoop\/tmp&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hadoop.proxyuser.root.hosts&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;*&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hadoop.proxyuser.root.groups&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;*&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br>&lt;\/configuration&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">hdfs-site.xml\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;configuration&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br>    &lt;!--\u6307\u5b9ahdfs\u4fdd\u5b58\u6570\u636e\u526f\u672c\u7684\u6570\u91cf\uff0c\u5305\u62ec\u81ea\u5df1\uff0c\u9ed8\u8ba4\u4e3a3--&gt;<br>    &lt;!--\u4f2a\u5206\u5e03\u5f0f\u6a21\u5f0f\uff0c\u6b64\u503c\u5fc5\u987b\u4e3a1--&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.replication&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;3&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.namenode.name.dir&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- name node \u5b58\u653e name table \u7684\u76ee\u5f55 --&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;file:\/usr\/local\/hadoop\/tmp\/hdfs\/name&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.namenode.secondary.http-address&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;hadoop02:50090&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.datanode.data.dir&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- data node \u5b58\u653e\u6570\u636e block \u7684\u76ee\u5f55 --&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;file:\/usr\/local\/hadoop\/tmp\/hdfs\/data&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.permissions&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;true&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;dfs.permissions.enabled&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;false&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br>&lt;\/configuration&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">mapred-site.xml \u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;configuration&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br>    &lt;!--\u6307\u5b9amapreduce\u8fd0\u884c\u5728yarn\u4e0a--&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;mapreduce.framework.name&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;yarn&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;yarn.app.mapreduce.am.env&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;HADOOP_MAPRED_HOME=${HADOOP_HOME}&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;mapreduce.map.env&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;HADOOP_MAPRED_HOME=${HADOOP_HOME}&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;mapreduce.reduce.env&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;HADOOP_MAPRED_HOME=${HADOOP_HOME}&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br>&lt;\/configuration&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">yarn-site.xml \u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;configuration&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;yarn.resourcemanager.hostname&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;hadoop01&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br>    &lt;!--NodeManager\u83b7\u53d6\u6570\u636e\u7684\u65b9\u5f0f--&gt;<br>     &nbsp;&lt;name&gt;yarn.nodemanager.aux-services&lt;\/name&gt;<br>     &nbsp;&lt;value&gt;mapreduce_shuffle&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br>&lt;\/configuration&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">workers\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>hadoop01<br>hadoop02<br>hadoop03<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">zookeeper\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5728\/usr\/local\/zookeeper\/conf\/\u6587\u4ef6\u5939\u4e0b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">zoo.cfg\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">tickTime=2000<br>\u200b<br>initLimit=10<br>\u200b<br>syncLimit=5<br>\u200b<br>dataDir=\/usr\/local\/zookeeper\/data<br>\u200b<br>clientPort=2181<br>\u200b<br>server.1=hadoop01:2888:3888<br>server.2=hadoop02:2888:3888<br>server.3=hadoop03:2888:3888<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">myid\u6587\u4ef6<\/h3>\n\n\n\n<p>\u5728\u96c6\u7fa4\u6bcf\u53f0\u673a\u5668\u7684 dataDir \u76ee\u5f55\u4e0b\u5efa\u7acb myid \u6587\u4ef6\uff0c\u6587\u4ef6\u5185\u5bb9\u4e0e server.x \u7684 x \u503c\u4e00\u81f4\uff0c\u6211\u4eec\u8fd9\u91cc\u662f\u5728\u955c\u50cf\u4fee\u6539\u914d\u7f6e\uff0c\u6240\u4ee5\u5148\u90fd\u5f04\u62101\uff0c\u4e4b\u540e\u518d\u6539\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/local\/zookeeper\nmkdir data\nnano myid<\/code><\/pre>\n\n\n\n<p>myid\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">hbase\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5728\/usr\/local\/hbase\/conf\/\u6587\u4ef6\u5939\u4e0b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">hbase-site.xml\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;configuration&gt;<br> &nbsp; &nbsp; &lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hbase.rootdir&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;hdfs:\/\/hadoop01:9000\/hbase&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hbase.zookeeper.quorum&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;hadoop01,hadoop02,hadoop03&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hbase.zookeeper.property.clientPort&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;2181&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hbase.cluster.distributed&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;true&lt;\/value&gt; <br> &nbsp; &nbsp;&lt;\/property&gt;<br> &nbsp; &nbsp;&lt;property&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;name&gt;hbase.zookeeper.property.dataDir&lt;\/name&gt;<br> &nbsp; &nbsp; &nbsp; &nbsp;&lt;value&gt;\/usr\/local\/zookeeper\/data&lt;\/value&gt;<br> &nbsp; &nbsp;&lt;\/property&gt;<br>&lt;\/configuration&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">hbase-env.sh\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\u52a0\u5165\uff1a<br>\u200b<br>export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP=true<br>\u200b<br>export JAVA_HOME=\/usr\/lib\/jvm\/java-8-openjdk-amd64<br>export HBASE_CLASSPATH=\/usr\/local\/hbase\/conf<br>export HBASE_MANAGES_ZK=flase<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">backup-master\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">hadoop01<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">regionservers\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">hadoop01<br>hadoop02<br>hadoop03<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u63d0\u4ea4\u955c\u50cf<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps -a\n\/\/\u627e\u5230\u4f60\u7684\u5bb9\u5668id\ndocker commit &lt;\u5bb9\u5668id&gt; hbase\n\/\/\u5c06\u8fd9\u4e2a\u72b6\u6001\u521b\u5efa\u4e3a\u540d\u4e3ahbase\u7684\u955c\u50cf<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">run<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d -p 16000:16000 -p 16030:16030 -p 16020:16020 -p 2181:2181 -p 2888:2888 -p 3888:3888 -p 50070:50070 -p 8020:8020 -p 50075:50075 -p 50010:50010 -p 8088:8088 -p 8032:8032 -p 8042:8042 -p 8040:8040 -p 19888:19888 -p 8080:8080 -p 4040-4050:4040-4050 -p 9000:9000 -p 8001:8001 -p 50090:50090 -p 9090:9090 -p 7070:7070 -p 7077:7077 -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 8084:8084 -it -h hadoop01 --name hadoop01 hbase\ndocker run -d -it -h hadoop02 --name hadoop02 hbase\ndocker run -d -it -h hadoop03 --name hadoop03 hbase<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u4fee\u653902\uff0c03\u673a\u5668\u4e0a\u7684myid<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker start hadoop01 hadoop02 hadoop03\n\ndocker exec -it hadoop01 bash\nexit\n\ndocker exec -it hadoop02 bash \/\/\u5206\u522b\u5728\u4e0d\u540c\u7ec8\u7aef\u8fd0\u884c\ncd \/usr\/local\/zookeeper\/data\nnano myid\n\u5c06\u5176myid\u5185\u5bb9\u4fee\u6539\u4e3a2\nexit\n\ndocker exec -it hadoop03 bash \/\/\u5206\u522b\u5728\u4e0d\u540c\u7ec8\u7aef\u8fd0\u884c\ncd \/usr\/local\/zookeeper\/data\nnano myid\n\u5c06\u5176myid\u5185\u5bb9\u4fee\u6539\u4e3a3\nexit<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u4fee\u6539hosts\u6587\u4ef6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker exec -it hadoop01 bash\ndocker exec -it hadoop02 bash\ndocker exec -it hadoop03 bash\n\/\/\u8fdb\u5165\u7ec8\u7aef\u540e\nsu - \/\/\u8fdb\u5165\u4e00\u4e0broot\u6743\u9650\u4e0d\u7136\u4e00\u4f1a\u73af\u5883\u53d8\u91cf\u7528\u4e0d\u4e86<\/code><\/pre>\n\n\n\n<p>\u4e09\u4e2a\u7ec8\u7aef\u90fd\u8f93\u5165\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/hosts\n\/\/\u4fee\u6539ip\u548c\u4e3b\u673a\u6620\u5c04\u5173\u7cfb\u4e3a\u5982\u4e0b\u5185\u5bb9\n172.17.0.2      hadoop01\n172.17.0.3      hadoop02\n172.17.0.4      hadoop03<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09\u4e2a\u673a\u5668\u4e92\u76f8ssh<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u4e09\u4e2a\u7ec8\u7aef\u90fd\u8981\u6253\u8fd9\u51e0\u884c\u547d\u4ee4\n\/\/\u6ce8\u610f\u5728\u4ea4\u4e92\u8fc7\u7a0b\u8981\u8f93\u5165yes\u5168\u90e8\u4e09\u4e2a\u5b57\u6bcd\uff0c\u4e0d\u8981\u53ea\u8bf4\u4e00\u4e2ay\nservice ssh start\nssh hadoop01\nexit\nssh hadoop02\nexit\nssh hadoop03\nexit<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u542f\u52a8<\/h2>\n\n\n\n<p>\u5148\u542f\u52a8hadoop\u96c6\u7fa4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su -\nhdfs namenode -format \/\/\u521d\u59cb\u5316\nstart-all.sh \/\/\u542f\u52a8\njps \/\/\u67e5\u770b\u4e00\u4e0b\n\u7ed3\u679c\uff1a\nroot@hadoop01:~# jps\n816 ResourceManager\n1393 Jps\n299 NameNode\n477 DataNode\n990 NodeManager\nroot@hadoop01:~#\nstop-all.sh \/\/\u505c\u6b62\uff0c\u6ce8\u610f\u53ea\u662f\u6d4b\u8bd5\u505c\u6b62\uff0c\u4e4b\u540e\u7684\u90fd\u9700\u8981\u8fd9\u4e2a\u4f5c\u4e3a\u57fa\u7840\u7684\uff0c\u8bb0\u5f97\u91cd\u65b0\u6253\u5f00<\/code><\/pre>\n\n\n\n<p>zookeeper\u542f\u52a8\u9700\u8981\u4e09\u53f0\u673a\u5668\u90fd\u542f\u52a8\uff0c\u505c\u6b62\u4e5f\u662f\u5206\u522b\u505c\u6b62\uff0c\u4e09\u53f0\u673a\u5668\u90fd\u542f\u52a8\u624d\u80fd\u770b\u89c1\u72b6\u6001<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su -\nzkServer.sh start\nzkServer.sh status \/\/\u9700\u8981\u4e09\u53f0\u90fd\u542f\u52a8\u540e\u518d\u67e5\u770b\u72b6\u6001\nzkServer.sh stop \/\/\u505c\u6b62\uff0c\u6ce8\u610f\u53ea\u662f\u6d4b\u8bd5\u505c\u6b62\uff0c\u4e4b\u540e\u7684\u90fd\u9700\u8981\u8fd9\u4e2a\u4f5c\u4e3a\u57fa\u7840\u7684\uff0c\u8bb0\u5f97\u91cd\u65b0\u6253\u5f00<\/code><\/pre>\n\n\n\n<p>hbase\u542f\u52a8\u5728hadoop01\u4e0a\u542f\u52a8\u5c31\u884c\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>su -\nstart-hbase.sh\nhbase shell \/\/\u8fdb\u5165\u63a7\u5236\u53f0\ncreate 'c','d'\nlist \/\/\u5c55\u793a\u521a\u521a\u5efa\u7acb\u7684\u8868\nexit\nhbase-daemon.sh start thrift \/\/\u542f\u52a8thrift\u670d\u52a1\uff0cpython\u53ef\u4ee5\u8fde\u63a5\nstop-hbase.sh \/\/\u505c\u6b62\uff0c\u6ce8\u610f\u53ea\u662f\u6d4b\u8bd5\u505c\u6b62\uff0c\u4e4b\u540e\u7684\u90fd\u9700\u8981\u8fd9\u4e2a\u4f5c\u4e3a\u57fa\u7840\u7684\uff0c\u8bb0\u5f97\u91cd\u65b0\u6253\u5f00<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u6700\u540e\u7684\u7ed3\u679c\u5e94\u8be5\u662f\u8fd9\u4e9b\nroot@hadoop01:~# jps\n4705 NameNode\n2354 DataNode\n6786 ThriftServer\n5188 ResourceManager\n5832 QuorumPeerMain\n6058 HMaster\n6203 HRegionServer\n3021 NodeManager\n6893 Jps\nroot@hadoop01:~#<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u524d\u9762\u6ca1\u642d\u5efadocker\uff0c\u8be6\u60c5\u8bf7\u770b\u8fd9\u7bc7\u6587\u7ae0\uff1ahttps:\/\/abytelalala.cn\/index.php [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[11,15,16],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-8","tag-hadoop","tag-hbase","tag-zookeeper"],"_links":{"self":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":57,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":289,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/55\/revisions\/289"}],"wp:attachment":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}