Hadoop的core-site.xml文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 3 4 5 6 <configuration> 7 <!-- 设置默认使用的文件系统 Hadoop支持file、HDFS、GFS、ali|Amazon云等文件系统 --> 8 <property> 控制hadoop与hbase的端口号相同 9 <name>fs.defaultFS</name> 10 <value>hdfs://node1:9000</value> 11 </property> 12 13 <!-- 设置Hadoop本地保存数据路径 --> 14 <property> 15 <name>hadoop.tmp.dir</name> 16 <value>/export/data/hadoop-3.3.0</value> 17 </property> 18 19 <!-- 设置HDFS web UI用户身份 --> 20 <property> 21 <name>hadoop.http.staticuser.user</name> 22 <value>root</value> 23 </property> 24 25 <!-- 整合hive 用户代理设置 --> 26 <property> 27 <name>hadoop.proxyuser.root.hosts</name> 28 <value>*</value> 29 </property> 30 31 <property> 32 <name>hadoop.proxyuser.root.groups</name> 33 <value>*</value> 34 </property> 35 <property> 36 <name>hadoop.proxyuser.root.hosts</name> 37 <value>*</value> 38 </property> 39 <property> 40 <name>hadoop.proxyuser.root.groups</name> 41 <value>*</value> 42 </property> 43 <!-- 文件系统垃圾桶保存时间 单位:分 --> 44 <property> 45 <name>fs.trash.interval</name> 46 <value>1440</value> 47 </property> 48 </configuration>
hbase的hbase-site.xml
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 3 <configuration>
设置 HBase 的集群模式为单机模式(false
表示伪分布式运行,适合测试环境)。 4 <property> 5 <name>hbase.cluster.distributed</name> 6 <value>false</value> 7 </property> 8 <property> 9 <name>hbase.tmp.dir</name> 10 <value>./tmp</value> 11 </property>
//取消安全模式 12 <property> 13 <name>hbase.unsafe.stream.capability.enforce</name> 14 <value>false</value> 15 </property> 16
//控制hbase的端口号(与hadoop相同) 17 <property> 18 <name>hbase.rootdir</name> 19 <value>hdfs://node1:9000/hbase</value> 20 </property>
设置 HBase 运行在分布式模式下(true
表示分布式集群运行,适合生产环境) 21 <property> 22 <name>hbase.cluster.distributed</name> 23 <value>true</value> 24 </property>
//指明zookeeper的端口号
25 <property> 26 <name>hbase.zookeeper.property.clientPort</name> 27 <value>2181</value> 28 </property> 29 30 </configuration>
hbase的hbase-env.sh
//jdk版本位置
1 export JAVA_HOME=/export/server/jdk1.8.0_241
//设置 HBase 的类路径,使其包含 Hadoop 配置文件的路径/usr/local/hadoop/conf
,以便 HBase 在分布式模式下能够找到 Hadoop 的相关配置。 2 export HBASE_CLASSPATH=/usr/local/hadoop/conf
//设置hbase使用自身带的zookeeper 3 export HBASE_MANAGES_ZK=true
//设置hbase不使用hadoop的依赖和类库 4 export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP=true 5 6 7 8 9 10 11 12 #!/usr/bin/env bash 13 # 14 #/** 15 # * Licensed to the Apache Software Foundation (ASF) under one 16 # * or more contributor license agreements. See the NOTICE file 17 # * distributed with this work for additional information 18 # * regarding copyright ownership. The ASF licenses this file 19 # * to you under the Apache License, Version 2.0 (the 20 # * "License"); you may not use this file except in compliance 21 # * with the License. You may obtain a copy of the License at 22 # * 23 # * http://www.apache.org/licenses/LICENSE-2.0 24 # * 25 # * Unless required by applicable law or agreed to in writing, software 26 # * distributed under the License is distributed on an "AS IS" BASIS, 27 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 # * See the License for the specific language governing permissions and 29 # * limitations under the License. 30 # */ 31 32 # Set environment variables here. 33 34 # This script sets variables multiple times over the course of starting an hbase process, 35 # so try to keep things idempotent unless you want to take an even deeper look 36 # into the startup scripts (bin/hbase, etc.) 37 38 # The java implementation to use. Java 1.8+ required. 39 # export JAVA_HOME=/usr/java/jdk1.8.0/ 40 41 # Extra Java CLASSPATH elements. Optional. 42 # export HBASE_CLASSPATH= 43 44 # The maximum amount of heap to use. Default is left to JVM default. 45 # export HBASE_HEAPSIZE=1G 46 47 # Uncomment below if you intend to use off heap cache. For example, to allocate 8G of 48 # offheap, set the value to "8G". 49 # export HBASE_OFFHEAPSIZE=1G 50 51 # Extra Java runtime options. 52 # Default settings are applied according to the detected JVM version. Override these default 53 # settings by specifying a value here. For more details on possible settings, 54 # see http://hbase.apache.org/book.html#_jvm_tuning 55 # export HBASE_OPTS 56 57 # Uncomment one of the below three options to enable java garbage collection logging for the server-side processes. 58 59 # This enables basic gc logging to the .out file. 60 # export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps" 61 62 # This enables basic gc logging to its own file. 63 # If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR . 64 # export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH>" 65 66 # This enables basic GC logging to its own file with automatic log rolling. Only applies to jdk 1.6.0_34+ and 1.7.0_2+. 67 # If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR . 68 # export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M" 69 70 # Uncomment one of the below three options to enable java garbage collection logging for the client processes. 71 72 # This enables basic gc logging to the .out file. 73 # export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps" 74 75 # This enables basic gc logging to its own file. 76 # If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR . 77 # export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH>" 78 79 # This enables basic GC logging to its own file with automatic log rolling. Only applies to jdk 1.6.0_34+ and 1.7.0_2+. 80 # If FILE-PATH is not replaced, the log file(.gc) would still be generated in the HBASE_LOG_DIR . 81 # export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:<FILE-PATH> -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M" 82 83 # See the package documentation for org.apache.hadoop.hbase.io.hfile for other configurations 84 # needed setting up off-heap block caching. 85 86 # Uncomment and adjust to enable JMX exporting 87 # See jmxremote.password and jmxremote.access in $JRE_HOME/lib/management to configure remote password access. 88 # More details at: http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html 89 # NOTE: HBase provides an alternative JMX implementation to fix the random ports issue, please see JMX 90 # section in HBase Reference Guide for instructions. 91 92 # export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 93 # export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101" 94 # export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102" 95 # export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103" 96 # export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104" 97 # export HBASE_REST_OPTS="$HBASE_REST_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10105" 98 99 # File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default. 100 # export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers 101 102 # Uncomment and adjust to keep all the Region Server pages mapped to be memory resident 103 #HBASE_REGIONSERVER_MLOCK=true 104 #HBASE_REGIONSERVER_UID="hbase" 105 106 # File naming hosts on which backup HMaster will run. $HBASE_HOME/conf/backup-masters by default. 107 # export HBASE_BACKUP_MASTERS=${HBASE_HOME}/conf/backup-masters 108 109 # Extra ssh options. Empty by default. 110 # export HBASE_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HBASE_CONF_DIR" 111 112 # Where log files are stored. $HBASE_HOME/logs by default. 113 # export HBASE_LOG_DIR=${HBASE_HOME}/logs 114 115 # Enable remote JDWP debugging of major HBase processes. Meant for Core Developers 116 # export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070" 117 # export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8071" 118 # export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8072" 119 # export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8073" 120 # export HBASE_REST_OPTS="$HBASE_REST_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8074" 121 122 # A string representing this instance of hbase. $USER by default. 123 # export HBASE_IDENT_STRING=$USER 124 125 # The scheduling priority for daemon processes. See 'man nice'. 126 # export HBASE_NICENESS=10 127 128 # The directory where pid files are stored. /tmp by default. 129 # export HBASE_PID_DIR=/var/hadoop/pids 130 131 # Seconds to sleep between slave commands. Unset by default. This 132 # can be useful in large clusters, where, e.g., slave rsyncs can 133 # otherwise arrive faster than the master can service them. 134 # export HBASE_SLAVE_SLEEP=0.1 135 136 # Tell HBase whether it should manage it's own instance of ZooKeeper or not. 137 # export HBASE_MANAGES_ZK=true 138 139 # The default log rolling policy is RFA, where the log file is rolled as per the size defined for the 140 # RFA appender. Please refer to the log4j.properties file to see more details on this appender. 141 # In case one needs to do log rolling on a date change, one should set the environment property 142 # HBASE_ROOT_LOGGER to "<DESIRED_LOG LEVEL>,DRFA". 143 # For example: 144 # HBASE_ROOT_LOGGER=INFO,DRFA 145 # The reason for changing default to RFA is to avoid the boundary case of filling out disk space as 146 # DRFA doesn't put any cap on the log size. Please refer to HBase-5655 for more context. 147 148 # Tell HBase whether it should include Hadoop's lib when start up, 149 # the default value is false,means that includes Hadoop's lib. 150 # export HBASE_DISABLE_HADOOP_CLASSPATH_LOOKUP="true" 151 152 # Override text processing tools for use by these launch scripts. 153 # export GREP="${GREP-grep}" 154 # export SED="${SED-sed}"
常用指令总结
①开始hadoop start-all.sh
结束 stop-all.sh
②开始hbase cd /usr/local/hbase //切换到hbase对应目录
bin/start-hbase.sh
结束 bin/stop-hbase.sh
③查看端口 jps
④结束某个端口 kill -s 9 端口号
⑤进入hbase数据库 cd /usr/local/hbase
hbase shell
⑥退出hbase shift+z
⑦退出某个insert界面 (shift+z)×2
附上学习教程
Hadoop之Hbase安装和配置_hadoop之hbase的安装与配置-CSDN博客
标签:配置,hadoop,XX,export,hbase,安装,HBASE,OPTS From: https://www.cnblogs.com/lian369/p/18450563