phoenix安装手记

1.下载代码

wget https://mirrors.tuna.tsinghua.edu.cn/apache/phoenix/apache-phoenix-4.13.1-HBase-1.3/bin/apache-phoenix-4.13.1-HBase-1.3-bin.tar.gz

2.解压
tar -zxvf apache-phoenix-4.13.1-HBase-1.3-bin.tar.gz

3.建立软链
ln -s /data/src/phoenix/apache-phoenix-4.13.1-HBase-1.3-bin phoenix

4.复制相关的包到hbase的lib下
cp phoenix-core-4.13.1-HBase-1.3.jar /data/service/hbase/lib/
cp phoenix-4.13.1-HBase-1.3-client.jar /data/service/hbase/lib/
cp phoenix-4.13.1-HBase-1.3-server.jar /data/service/hbase/lib/
cp phoenix-4.13.1-HBase-1.3-thin-client.jar /data/service/hbase/lib/

5.设置环境变量
export PHOENIX_HOME=/data/service/phoenix
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin

6.重启hbase
hbase-daemon.sh stop regionserver
hbase-daemon.sh start regionserver

hbase-daemon.sh stop master
hbase-daemon.sh start master

7.验证数据
root@bigdata-test-07:/data/service/phoenix/bin# ./sqlline.py 10.23.58.154:2181 ../examples/STOCK_SYMBOL.sql
Connected to: Phoenix (version 4.13)
Driver: PhoenixEmbeddedDriver (version 4.13)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)…
92/92 (100%) Done
Done
1/4 CREATE TABLE IF NOT EXISTS STOCK_SYMBOL (SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);
No rows affected (4.581 seconds)
2/4 UPSERT INTO STOCK_SYMBOL VALUES (‘CRM’,’SalesForce.com’);
1 row affected (0.044 seconds)
3/4 SELECT * FROM STOCK_SYMBOL;
+———+—————–+
| SYMBOL | COMPANY |
+———+—————–+
| CRM | SalesForce.com |
+———+—————–+
1 row selected (0.032 seconds)
4/4
Closing: org.apache.phoenix.jdbc.PhoenixConnection
sqlline version 1.2.0
root@bigdata-test-07:/data/service/phoenix/bin#

8.帮助
0: jdbc:phoenix:10.23.58.154:2181> help
!all Execute the specified SQL against all the current
connections
!autocommit Set autocommit mode on or off
!batch Start or execute a batch of statements
!brief Set verbose mode off
!call Execute a callable statement
!close Close the current connection to the database
!closeall Close all current open connections
!columns List all the columns for the specified table
!commit Commit the current transaction (if autocommit is off)
!connect Open a new connection to the database.
!dbinfo Give metadata information about the database
!describe Describe a table
!dropall Drop all tables in the current database
…….

作者: inter12

在这苦短的人生中,追求点自己的简单快乐

发表评论

电子邮件地址不会被公开。 必填项已用*标注