Doris Docker 部署

1 . doris编译:参照官网docker编译,编译完成后在output下会编译后的软件。

(base)  ~/incubator-doris :ls output 
apache_hdfs_broker be                 fe                 udf
  1. 创建Doris安装目录,并将编译好的文件复制到安装目录。
mkidr docker
cp -r incubator-doris/output/fe docker/doris/
ls docker/doris/
cp -r incubator-doris/output/be docker/doris/be-01
cp -r incubator-doris/output/be docker/doris/be-02
cp -r incubator-doris/output/be docker/doris/be-03

3.启动FE Docker

docker run -it -p 8030:8030 -p 9030:9030 -d --name=doris-fe -v /your_parh/doris/docker/doris/fe:/opt/doris/fe -v /Users/wangleigis163.com/Documents/alex/dev/evn/doris/docker/doris-meta:/opt/doris/doris-meta apache/incubator-doris:build-env-ldb-toolchain-latest
  1. 进入FE-Docker以及安装组件
#进入fe-docker
docker exec -ti doris-fe /bin/bash
# 安装net-tools用于查看IP
yum install net-tools -y
  1. 修改FE配置
# 查看fe-docker的IPv4地址
ifconfig
# 修改配置文件
vim /opt/doris/fe/conf/fe.conf
# 取消priority_networks的注解,并根据Docker的网段进行配置
priority_networks = 172.17.0.0/16 #这里要根据你Docker的IP确定

  1. 配置JDK:由于最新版本(1.0.1_r3)Doris容器换编译默认是JDK11的因此需要将JDK设置为11
alternatives --set java java-11-openjdk.x86_64
alternatives --set javac java-11-openjdk.x86_64
export JAVA_HOME=/usr/lib/jvm/java-11
  1. 配置FE-Docker的环境变量
# 配置环境变量
vim /etc/profile.d/doris.sh
export DORIS_HOME=/opt/doris/fe/
export PATH=$PATH:$DORIS_HOME/bin
# 保存并source
source /etc/profile.d/doris.sh
  1. 启动Doris-FE
start_fe.sh --daemon
  1. 启动验证
    在浏览器输入:http://127.0.0.1:8030/home,看到如下界面说明启动成功。
    Doris Docker 部署_第1张图片
  2. 启动BE Docker

docker run -it -p 9061:9060 -d --name=doris-be-01 -v /your_path/doris/docker/doris/be-01:/opt/doris/be apache/incubator-doris:build-env-ldb-toolchain-latest
docker run -it -p 9062:9060 -d --name=doris-be-02 -v /your_path/doris/docker/doris/be-02:/opt/doris/be apache/incubator-doris:build-env-ldb-toolchain-latest
docker run -it -p 9063:9060 -d --name=doris-be-03 -v /your_path/docker/doris/be-03:/opt/doris/be apache/incubator-doris:build-env-ldb-toolchain-latest
  1. 进入每个BE-Docker以及安装网络组件,这里示例为进入第一个容器。
# 进入fe-docker,以01为例
docker exec -ti doris-be-01 /bin/bash
# 安装net-tools用于查看IP
yum install net-tools -y
  1. 修改BE配置
# 查看fe-docker的IPv4地址
ifconfig
# 修改配置文件
vim /opt/doris/be/conf/be.conf
# 取消priority_networks的注解,并根据Docker的网段进行配置
priority_networks = 172.17.0.0/16 #这里要根据你Docker的IP确定
  1. 配置BE-Docker的环境变量
# 配置环境变量
vim /etc/profile.d/doris.sh
export DORIS_HOME=/opt/doris/be/
export PATH=$PATH:$DORIS_HOME/bin
# 保存并source
source /etc/profile.d/doris.sh  
  1. 启动Doris-BE
start_be.sh --daemon

15 MySQL 登录

mysql -h 127.0.0.1 -P9030 -uroot
  1. 添加BE节点。
#这里172.17.0.4等为我的容器私网ip,9050为be 默认heartbeat_service_port
ALTER SYSTEM ADD BACKEND "172.17.0.4:9050";
ALTER SYSTEM ADD BACKEND "172.17.0.5:9050";
ALTER SYSTEM ADD BACKEND "172.17.0.6:9050";
  1. 节点查询。
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                                                                                                                        |
+-----------+-----------------+------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------------+--------+---------------+-------------------------------------------------------------------------------------------------------------------------------+
| 10002     | default_cluster | 172.17.0.4 | 172.17.0.4 | 9050          | 9060   | 8040     | 8060     | 2022-05-11 03:56:17 | 2022-05-11 04:09:58 | true  | false                | false                 | 0         | 0.000            | 118.799 GB    | 465.627 GB    | 74.49 % | 74.49 %        | {"location" : "default"} |        | trunk-eec1dfd | {"lastSuccessReportTabletsTime":"2022-05-11 04:09:57","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} |
| 10003     | default_cluster | 172.17.0.5 | 172.17.0.5 | 9050          | 9060   | 8040     | 8060     | 2022-05-11 03:56:31 | 2022-05-11 04:09:58 | true  | false                | false                 | 0         | 0.000            | 118.799 GB    | 465.627 GB    | 74.49 % | 74.49 %        | {"location" : "default"} |        | trunk-eec1dfd | {"lastSuccessReportTabletsTime":"2022-05-11 04:09:58","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} |
| 10004     | default_cluster | 172.17.0.6 | 172.17.0.6 | 9050          | 9060   | 8040     | 8060     | 2022-05-11 03:56:32 | 2022-05-11 04:09:58 | true  | false                | false                 | 0         | 0.000            | 118.799 GB    | 465.627 GB    | 74.49 % | 74.49 %        | {"location" : "default"} |        | trunk-eec1dfd | {"lastSuccessReportTabletsTime":"2022-05-11 04:09:57","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} |
+-----------+-----------------+------------+------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------------+--------+---------------+-------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.62 sec)
  1. 建库建表。
create database mongo_doris;
use mongo_doris;

CREATE TABLE data_sync_test_simple
 (
         _id VARCHAR(32) DEFAULT '',
         id VARCHAR(32) DEFAULT '',
         user_name VARCHAR(32) DEFAULT '',
         member_list VARCHAR(32) DEFAULT ''
 )
 DUPLICATE KEY(_id)
 DISTRIBUTED BY HASH(_id) BUCKETS 10
 PROPERTIES("replication_num" = "1");

19 数据插入和查询

INSERT INTO data_sync_test_simple VALUES ('1','1','alex','123');

mysql> select * from data_sync_test_simple;
+------+------+-----------+-------------+
| _id  | id   | user_name | member_list |
+------+------+-----------+-------------+
| 1    | 1    | alex      | 123         |
+------+------+-----------+-------------+
1 row in set (0.97 sec)

你可能感兴趣的:(Doris,docker,容器,大数据)