doris常用操作

2021-12-25  本文已影响0人  wudl

1. doris 的启动

1. 先启动fe  
    ./start_be.sh --daemon
2. 在启动be
 ./start_be.sh --daemon

2. 给fe 添加be

mysql> ALTER SYSTEM ADD BACKEND "192.168.1.161:9050";
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER SYSTEM ADD BACKEND "192.168.1.162:9050";
Query OK, 0 rows affected (0.01 sec)

mysql> ALTER SYSTEM ADD BACKEND "192.168.1.163:9050";
Query OK, 0 rows affected (0.00 sec)


3.删除be

ALTER SYSTEM DROPP BACKEND "192.168.1.160:9050";

4. 查看fe 状态

SHOW PROC '/frontends';

mysql> SHOW PROC '/frontends';
+----------------------------------+---------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+---------------------+------------------+
| Name                             | IP            | HostName   | EditLogPort | HttpPort | QueryPort | RpcPort | Role     | IsMaster | ClusterId  | Join | Alive | ReplayedJournalId | LastHeartbeat       | IsHelper | ErrMsg | Version             | CurrentConnected |
+----------------------------------+---------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+---------------------+------------------+
| 192.168.1.161_9010_1640357809764 | 192.168.1.161 | node01.com | 9010        | 8090     | 9030      | 9020    | FOLLOWER | true     | 1886445949 | true | true  | 2206              | 2021-12-25 00:03:54 | true     |        | 0.15.1-rc09-Unknown | Yes              |
+----------------------------------+---------------+------------+-------------+----------+-----------+---------+----------+----------+------------+------+-------+-------------------+---------------------+----------+--------+---------------------+------------------+
1 row in set (0.02 sec)

mysql> 

5. 查看be 状态

mysql> SHOW PROC '/backends';
+-----------+-----------------+---------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------------+--------+---------------------+--------------------------------------------------------------------------------+
| BackendId | Cluster         | IP            | HostName   | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime       | LastHeartbeat       | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | Tag                      | ErrMsg | Version             | Status                                                                         |
+-----------+-----------------+---------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------------+--------+---------------------+--------------------------------------------------------------------------------+
| 10004     | default_cluster | 192.168.1.161 | node01.com | 9050          | 9060   | 18040    | 8060     | 2021-12-24 23:35:22 | 2021-12-25 00:04:44 | true  | false                | false                 | 1         | 0.000            | 121.115 GB    | 190.907 GB    | 36.56 % | 36.56 %        | {"location" : "default"} |        | 0.15.1-rc09-Unknown | {"lastSuccessReportTabletsTime":"2021-12-25 00:03:49","lastStreamLoadTime":-1} |
| 10005     | default_cluster | 192.168.1.162 | node02.com | 9050          | 9060   | 18040    | 8060     | 2021-12-24 23:35:12 | 2021-12-25 00:04:44 | true  | false                | false                 | 8         | 0.000            | 163.504 GB    | 190.907 GB    | 14.35 % | 14.35 %        | {"location" : "default"} |        | 0.15.1-rc09-Unknown | {"lastSuccessReportTabletsTime":"2021-12-25 00:04:33","lastStreamLoadTime":-1} |
| 10006     | default_cluster | 192.168.1.163 | node03.com | 9050          | 9060   | 18040    | 8060     | 2021-12-24 23:35:46 | 2021-12-25 00:04:44 | true  | false                | false                 | 8         | 1.074 KB         | 158.105 GB    | 190.907 GB    | 17.18 % | 17.18 %        | {"location" : "default"} |        | 0.15.1-rc09-Unknown | {"lastSuccessReportTabletsTime":"2021-12-25 00:04:07","lastStreamLoadTime":-1} |
+-----------+-----------------+---------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------------+--------+---------------------+--------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

mysql> 

6. 查看BE集群状态

SHOW PROC '/backends'\G 或者 show backends \G

mysql> SHOW PROC '/backends'\G
*************************** 1. row ***************************
            BackendId: 10004
              Cluster: default_cluster
                   IP: 192.168.1.161
             HostName: node01.com
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 18040
             BrpcPort: 8060
        LastStartTime: 2021-12-24 23:35:22
        LastHeartbeat: 2021-12-25 00:05:49
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 1
     DataUsedCapacity: 0.000 
        AvailCapacity: 121.116 GB
        TotalCapacity: 190.907 GB
              UsedPct: 36.56 %
       MaxDiskUsedPct: 36.56 %
                  Tag: {"location" : "default"}
               ErrMsg: 
              Version: 0.15.1-rc09-Unknown
               Status: {"lastSuccessReportTabletsTime":"2021-12-25 00:04:53","lastStreamLoadTime":-1}
*************************** 2. row ***************************
            BackendId: 10005
              Cluster: default_cluster
                   IP: 192.168.1.162
             HostName: node02.com
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 18040
             BrpcPort: 8060
        LastStartTime: 2021-12-24 23:35:12
        LastHeartbeat: 2021-12-25 00:05:49
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 8
     DataUsedCapacity: 0.000 
        AvailCapacity: 163.505 GB
        TotalCapacity: 190.907 GB
              UsedPct: 14.35 %
       MaxDiskUsedPct: 14.35 %
                  Tag: {"location" : "default"}
               ErrMsg: 
              Version: 0.15.1-rc09-Unknown
               Status: {"lastSuccessReportTabletsTime":"2021-12-25 00:05:37","lastStreamLoadTime":-1}
*************************** 3. row ***************************
            BackendId: 10006
              Cluster: default_cluster
                   IP: 192.168.1.163
             HostName: node03.com
        HeartbeatPort: 9050
               BePort: 9060
             HttpPort: 18040
             BrpcPort: 8060
        LastStartTime: 2021-12-24 23:35:46
        LastHeartbeat: 2021-12-25 00:05:49
                Alive: true
 SystemDecommissioned: false
ClusterDecommissioned: false
            TabletNum: 2
     DataUsedCapacity: 1.074 KB
        AvailCapacity: 158.106 GB
        TotalCapacity: 190.907 GB
              UsedPct: 17.18 %
       MaxDiskUsedPct: 17.18 %
                  Tag: {"location" : "default"}
               ErrMsg: 
              Version: 0.15.1-rc09-Unknown
               Status: {"lastSuccessReportTabletsTime":"2021-12-25 00:05:11","lastStreamLoadTime":-1}
3 rows in set (0.00 sec)

mysql> 

7. 在按照doris 的时候默认端口会和yarn 的端口冲突

doris 端口.png

8. mysql 客户端连接

[root@node02 conf]# mysql -u root -P 9030 -h 192.168.1.161
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.0 Doris version 0.15.1-rc09-Unknown

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

9. 创建表插入数据

CREATE TABLE wudluser (
    id INT,
    name VARCHAR(26),
    address VARCHAR(26),
    city VARCHAR(11),
    phone VARCHAR(16) )
DISTRIBUTED BY hash(id) 
PROPERTIES ( 
  "storage_type"="column", 
  "replication_num"="1");
INSERT INTO wudluser(id,NAME,address,city,phone) VALUES (2,'flink','深圳','南山','18575697660');

SELECT * FROM wudldb.wudluser

10 集群启动脚本

[root@node01 shell]# vi doris-cluster.sh 

#! /bin/bash
SERVERS="node01.com node02.com node03.com"
MASTER="node01.com"

case $1 in
"start") {
echo "------正在启动Doris集群------"
        for SERVER in $SERVERS
    do
            ssh $SERVER "source /etc/profile ; /opt/module/doris/doris15/fe/bin/start_fe.sh --daemon"
    done

          for SERVER in $SERVERS
    do
         ssh $SERVER "source /etc/profile; /opt/module/doris/doris15/be/bin/start_be.sh --daemon"
    done

echo "------启动FE集群------"
echo "------启动BE集群------"

};;
"stop"){
echo "------正在停止Doris集群------"
    for SERVER in $SERVERS
    do
            ssh $SERVER "source /etc/profile ; /opt/module/doris/doris15/fe/bin/stop_fe.sh --daemon"
    done
        for SERVER in $SERVERS
    do
         ssh $SERVER "source /etc/profile ; /opt/module/doris/doris15/be/bin/stop_be.sh --daemon"
    done

echo "------停止BE集群------"

echo "------停止FE集群------"
};;
esac
~                             
上一篇 下一篇

猜你喜欢

热点阅读