MAC单机部署HBase+Phoenix

一、brew安装HBase:

brew install hbase

1:运行结果

Updating Homebrew...
==> Installing dependencies for hbase: lzo
==> Installing hbase dependency: lzo
==> Downloading https://homebrew.bintray.com/bottles/lzo-2.10.catalina.bottle.tar.gz
Already downloaded: /Users/duchao/Library/Caches/Homebrew/downloads/24d54a83f3cd4083745a790e68a7664c8bc1747af893d6a271c1c77c1953af43--lzo-2.10.catalina.bottle.tar.gz
==> Pouring lzo-2.10.catalina.bottle.tar.gz
  /usr/local/Cellar/lzo/2.10: 31 files, 546.7KB
==> Installing hbase
==> Downloading https://homebrew.bintray.com/bottles/hbase-1.3.5.catalina.bottle.tar.gz
Already downloaded: /Users/duchao/Library/Caches/Homebrew/downloads/d073cc999dc121170a4a142598a9a2c4e271d0f6ba5f50d73b9132c5560d2966--hbase-1.3.5.catalina.bottle.tar.gz
==> Pouring hbase-1.3.5.catalina.bottle.tar.gz
==> Caveats
To have launchd start hbase now and restart at login:
  brew services start hbase
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/hbase/bin/start-hbase.sh
==> Summary
  /usr/local/Cellar/hbase/1.3.5: 10,226 files, 345.8MB
==> Caveats
==> hbase
To have launchd start hbase now and restart at login:
  brew services start hbase
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/hbase/bin/start-hbase.sh

2:修改JAVAHOME

/usr/local/Cellar/hbase/1.3.5/libexec/conf目录下hbase-env.sh文件中JAVA_HOME属性

3:修改内建zookeeper配置

/usr/local/Cellar/hbase/1.3.5/libexec/conf目录下hbase-site.xml文件中修改下面属性

<property>
    <name>hbase.zookeeper.property.dataDir</name>
    <!-- 这里valu值自己调整 -->
    <value>/Users/duchao/Code/server/zk</value>
</property>

4:启动HBase

brew services start hbase

5:检查HBase是否安装成功

执行命令jps, 有HMaster说明安装成功

6:停止HBase

brew services stop hbase

7:常用hbase shell命令

二、Phonenix部署

1. 下载Phonenix

从phonenix下载地址下载hbase对应版本的包,并解压在合适目录

2.将Phonenix目录下的phoenix-4.15.0-HBase-1.3-server.jar和phoenix-core-4.15.0-HBase-1.3.jar放到HBase的lib目录下(/usr/local/Cellar/hbase/1.3.5/libexec/lib)

3.重启HBase

brew services stop hbase
brew services start hbase

4.启动Phoenix

在phoenix目录下bin中运行./sqlline.py 127.0.0.1:2181
运行结果:

Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:127.0.0.1:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:127.0.0.1:2181
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.hadoop.security.authentication.util.KerberosUtil (file:/Users/duchao/Code/server/apache-phoenix-4.15.0/phoenix-4.15.0-HBase-1.3-client.jar) to method sun.security.krb5.Config.getInstance()
WARNING: Please consider reporting this to the maintainers of org.apache.hadoop.security.authentication.util.KerberosUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20/05/20 09:08:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 4.15)
Driver: PhoenixEmbeddedDriver (version 4.15)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
154/154 (100%) Done
Done
sqlline version 1.5.0

5.测试sql运行

-- 创建订单
CREATE TABLE IF NOT EXISTS tbl_order (
	id BIGINT not null primary key,
	order_code char(20),
	total_amount decimal(10,2),
	create_time date,
	user_id bigint
);
-- 插入数据
upsert into tbl_order values(1, 'A001', 10.5, '2019-3-19 23:35:00', 1);
upsert into tbl_order values(2, 'A002', 60.0, '2019-3-19 23:36:00', 2);
upsert into tbl_order values(3, 'B001', 66.6, '2019-3-20 01:01:00', 3);
upsert into tbl_order values(4, 'C001', 66.4, '2019-3-20 02:01:00', 3);
-- 查询表数据
select * from tbl_order;

到此部署完成,下一篇介绍通过springboot+mybatis-plus集成phonenix完成增删改查功能

你可能感兴趣的:(环境构建,解决方案,系统整合,hbase,hadoop,大数据)