In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use phoenix to manipulate hbase data). The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
1. Download and install phoenix (version corresponds to hbase)
[root@node1 ~] # wget http://mirrors.shu.edu.cn/apache/phoenix/apache-phoenix-5.0.0-HBase-2.0/bin/apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz
[root@node1] # tar xvf apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz-C / opt/
[root@node1 opt] # mv apache-phoenix-5.0.0-HBase-2.0-bin/ phoenix-5.0.0
two。 Cobbe jar bag
[root@node1 opt] # cd phoenix-5.0.0/
[root@node1 phoenix-5.0.0] # cp-a phoenix-5.0.0-HBase-2.0-server.jar phoenix-core-5.0.0-HBase-2.0.jar / opt/hbase-2.0.4/lib/
[root@node1 phoenix-5.0.0] # scp phoenix-5.0.0-HBase-2.0-server.jar phoenix-core-5.0.0-HBase-2.0.jar node2:/opt/hbase-2.0.4/lib/-- Corbe goes to other nodes
[root@node1 phoenix-5.0.0] # cd / opt/hbase-2.0.4/conf/
[root@node1 conf] # cp-a hbase-site.xml / opt/phoenix-5.0.0/bin/
[root@node1 conf] # cd / opt/hadoop-2.8.5/etc/hadoop/
[root@node1 hadoop] # cp hdfs-site.xml core-site.xml / opt/phoenix-5.0.0/bin/
3. Restart the hbase service
[root@node1 conf] # stop-hbase.sh
[root@node1 conf] # start-hbase.sh
4. Log in to hbase and phoenix
[root@node1 phoenix-5.0.0] # hbase shell
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.0.4, r205e39c5704bf38568b34926dde9f1ee76e6b5d0, Fri Dec 28 22:13:42 PST 2018
Took 0.0066 seconds
Hbase (main): 001list 0 > list-- View the table in hbase
TABLE
T1
1 row (s)
Took 1.1812 seconds
= > ["T1"]
Hbase (main): 002purl 0 > exit
[root@node1 bin] #. / sqlline.py node1,node2,node3:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
Issuing:! connect jdbc:phoenix:node1,node2,node3:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:node1,node2,node3:2181
19-03-17 15:22:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... Using builtin-java classes where applicable
Connected to: Phoenix (version 5.0)
Driver: PhoenixEmbeddedDriver (version 5.0)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
133more 133 (100%) Done
Done
Sqlline version 1.2.0
0: jdbc:phoenix:node1,node2,node3:2181 >! tables-shows all tables
+- -+
| | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | INDEX_STATE |
+- -+
| | SYSTEM | CATALOG | SYSTEM TABLE | | |
| | SYSTEM | FUNCTION | SYSTEM TABLE | | |
| | SYSTEM | LOG | SYSTEM TABLE | | |
| | SYSTEM | SEQUENCE | SYSTEM TABLE | | |
| | SYSTEM | STATS | SYSTEM TABLE | | |
+- -+
0: jdbc:phoenix:node1,node2,node3:2181 >
5. Import table structure and data
[root@node1 bin] #. / psql.py node1:2181.. / examples/STOCK_SYMBOL.sql.. / examples/STOCK_SYMBOL.csv
19-03-17 15:33:27 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... Using builtin-java classes where applicable
No rows upserted
Time: 2.85 sec (s)
1 row upserted
Time: 0.35sec (s)
SYMBOL COMPANY
CRM SalesForce.com
Time: 0.074 sec (s)
Csv columns from database.
CSV Upsert complete. 9 rows upserted
Time: 0.065 sec (s)
[root@node1 bin] #. / sqlline.py node1,node2,node3:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
Issuing:! connect jdbc:phoenix:node1,node2,node3:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:node1,node2,node3:2181
19-03-17 15:22:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... Using builtin-java classes where applicable
Connected to: Phoenix (version 5.0)
Driver: PhoenixEmbeddedDriver (version 5.0)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
133more 133 (100%) Done
Done
Sqlline version 1.2.0
0: jdbc:phoenix:node1,node2,node3:2181 >! tables
+- -+
| | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | INDEX_STAT |
+- -+
| | SYSTEM | CATALOG | SYSTEM TABLE | | |
| | SYSTEM | FUNCTION | SYSTEM TABLE | | |
| | SYSTEM | LOG | SYSTEM TABLE | | |
| | SYSTEM | SEQUENCE | SYSTEM TABLE | | |
| | SYSTEM | STATS | SYSTEM TABLE | | |
| | STOCK_SYMBOL | TABLE | | |
+- -+
0: jdbc:phoenix:node1,node2,node3:2181 > select * from STOCK_SYMBOL
+-+
| | SYMBOL | COMPANY |
+-+
| | AAPL | APPLE Inc. | |
| | CRM | SALESFORCE |
| | GOOG | Google |
| | HOG | Harlet-Davidson Inc. | |
| | HPQ | Hewlett Packard |
| | INTC | Intel |
| | MSFT | Microsoft |
| | WAG | Walgreens |
| | WMT | Walmart |
+-+
9 rows selected (0.112 seconds)
0: jdbc:phoenix:node1,node2,node3:2181 >
This is the end of this article on "how to use phoenix to manipulate hbase data). I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.