Hbase集成Phoenix

>>上传安装包至 /opt/soft 目录

Hbase集成Phoenix

>>创建安装目录

mkdir /opt/module/phoenix

>>解压安装包

tar -zxvf apache-phoenix-4.14.2-HBase-1.3-bin.tar.gz -C /opt/module/phoenix/ --strip-components 1

>>在 /opt/module/phoenix/bin目录下拷贝下列xml文件

cd /opt/module/phoenix/bin

ln -s /opt/module/hadoop-2.7.2/etc/hadoop/hdfs-site.xml

ln -s /opt/module/hbase/conf/hbase-site.xml

ln -s /opt/module/hadoop-2.7.2/etc/hadoop/core-site.xml

Hbase集成Phoenix

>>编辑 hbase-site.xml 文件

<configuration>

	<property>
		<name>phoenix.query.timeoutMs</name>
		<value>1800000</value>
	</property>

	<property>
		<name>hbase.rpc.timeout</name>
		<value>1200000</value>
	</property>

	<property>
		<name>hbase.client.scanner.timeout.period</name>
		<value>1200000</value>
	</property>

	<property>     
		<name>hbase.rootdir</name>     
		<value>hdfs://hadoop103:9000/HBase</value>   
	</property>

	<property>   
		<name>hbase.cluster.distributed</name>
		<value>true</value>
	</property>

   	<!-- 0.98后的新变动,之前版本没有.port,默认端口为60000 -->
	<property>
		<name>hbase.master.port</name>
		<value>16000</value>
	</property>

	<property>    
		<name>hbase.zookeeper.quorum</name>
	     	<value>hadoop102,hadoop103,hadoop104</value>
	</property>

	<property>   
		<name>hbase.zookeeper.property.dataDir</name>
	     	<value>/opt/module/zookeeper-3.4.10/zkData</value>
	</property>

	<property>
  		<name>phoenix.schema.isNamespaceMappingEnabled</name>
  		<value>true</value>
	</property>

	<property>
  		<name>phoenix.schema.mapSystemTablesToNamespace</name>
  		<value>true</value>
	</property>

	<property>
        <name>hbase.table.sanity.checks</name>
        <value>false</value>
	</property>

	<!-- phoenix regionserver 配置参数( 开启索引功能 ) -->
	<property>
        <name>hbase.regionserver.wal.codec</name>
        <value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
	</property>

	<property>
        <name>hbase.region.server.rpc.scheduler.factory.class</name>
        <value>org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory</value>
	</property>

	<property>
        <name>hbase.rpc.controllerfactory.class</name>
   		<value>org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory</value>
	</property>

	<property>
        <name>hbase.master.loadbalancer.class</name>
        <value>org.apache.phoenix.hbase.index.balancer.IndexLoadBalancer</value>
	</property>

	<property>
        <name>hbase.coprocessor.master.classes</name>
        <value>org.apache.phoenix.hbase.index.master.IndexMasterObserver</value>
	</property>

</configuration>

>>编辑 /etc/profile

Hbase集成Phoenix

#phoenix environment
export PHOENIX_HOME=/opt/module/phoenix
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin

>>重新编译 /etc/profile 文件

source /etc/profile

>>启动Hadoop,Zookeeper,HBase

start-dfs.sh

start-yarn.sh

zkServer.sh start

start-hbase.sh

>>使用 sqlline.py 

sqlline.py hadoop102,hadoop103,hadoop104:2181

>>查询所有表

!tables

上一篇:06


下一篇:111