Kudu 安裝
快速開始
準備好docker環境,如果沒有請自行搜索
Clone the Repository
git clone https://github.com/apache/kudu
cd kudu
啓動集羣
設置IP
export KUDU_QUICKSTART_IP=$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | tail -1)
啓動
Then use docker-compose
to start a cluster with 3 master servers and 5 tablet servers. When inside the docker network/containers the master addresses will be kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251
and when on the host machine you can specify the master addresses with localhost:7051,localhost:7151,localhost:7251
.
docker-compose -f docker/quickstart.yml up -d
You can include the
-d
flag to run the cluster in the background.
查看kudu控制檯界面
Once the cluster is started you can view the master web-ui by visiting localhost:8050.
檢查集羣健康
Use the command below to get a bash shell in the kudu-master-1
container:
docker exec -it $(docker ps -aqf "name=kudu-master-1") /bin/bash
You can now run the Kudu ksck
tool to verify the cluster is healthy:
kudu cluster ksck kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251
Alternatively, if you have a kudu binary available on your host machine, you can run ksck
there via:
export KUDU_USER_NAME=kudu
kudu cluster ksck localhost:7051,localhost:7151,localhost:7251
生產環境安裝
命令
集羣
#集羣健康:
kudu cluster ksck kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251
表
# 1. 類似 show tables
kudu@92b472a0be64:/opt/kudu$ kudu table list kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251
student
student2
# 2. 掃描表 類似 select * from student2
kudu@92b472a0be64:/opt/kudu$ kudu table scan kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251 student2
(int32 id=4, string name="zhangsan-4", int32 age=24, int32 sex=0)
(int32 id=1, string name="zhangsan-1", int32 age=21, int32 sex=1)
(int32 id=5, string name="zhangsan-5", int32 age=25, int32 sex=1)
(int32 id=6, string name="zhangsan-6", int32 age=26, int32 sex=0)
(int32 id=7, string name="zhangsan-7", int32 age=27, int32 sex=1)
T b7ffe064c8894abaaf955c12a097f2e4 scanned count 1 cost 0.0124023 seconds
T 541e387b121643b499a1eb164a864eff scanned count 4 cost 0.0124951 seconds
T 4199041ed86e45da8c54ed78350fd7f9 scanned count 0 cost 0.0118958 seconds
(int32 id=3, string name="zhangsan-3", int32 age=23, int32 sex=1)
(int32 id=10, string name="zhangsan-10", int32 age=30, int32 sex=0)
T 632e49f6c5874e2c96a8e53b5953a442 scanned count 2 cost 0.0126947 seconds
(int32 id=8, string name="zhangsan-8", int32 age=28, int32 sex=0)
(int32 id=9, string name="zhangsan-9", int32 age=29, int32 sex=1)
T 137406191ebe40d9878c4d197c2afb4f scanned count 2 cost 0.00449864 seconds
T 851b8c9d8cf645adabaff8e624e27508 scanned count 0 cost 0.00425724 seconds
Total count 9 cost 0.100472 seconds
# 3. 表分析
kudu@92b472a0be64:/opt/kudu$ kudu table statistics kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251 student2
TABLE student2
on disk size: 50492574
live row count: 9
# 4. 表詳情
kudu@92b472a0be64:/opt/kudu$ kudu table describe kudu-master-1:7051,kudu-master-2:7151,kudu-master-3:7251 student2
TABLE student2 (
id INT32 NOT NULL,
name STRING NOT NULL,
age INT32 NOT NULL,
sex INT32 NOT NULL,
PRIMARY KEY (id)
)
HASH (id) PARTITIONS 6,
RANGE (id) (
PARTITION UNBOUNDED
)
REPLICAS 3
CDH 版本自行搜索