1 . doris编译:参照官网docker编译,编译完成后在output下会编译后的软件。
(base) ~/incubator-doris :ls output
apache_hdfs_broker be fe udf
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
#进入fe-docker
docker exec -ti doris-fe /bin/bash
# 安装net-tools用于查看IP
yum install net-tools -y
# 查看fe-docker的IPv4地址
ifconfig
# 修改配置文件
vim /opt/doris/fe/conf/fe.conf
# 取消priority_networks的注解,并根据Docker的网段进行配置
priority_networks = 172.17.0.0/16 #这里要根据你Docker的IP确定
alternatives --set java java-11-openjdk.x86_64
alternatives --set javac java-11-openjdk.x86_64
export JAVA_HOME=/usr/lib/jvm/java-11
# 配置环境变量
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
start_fe.sh --daemon
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
# 进入fe-docker,以01为例
docker exec -ti doris-be-01 /bin/bash
# 安装net-tools用于查看IP
yum install net-tools -y
# 查看fe-docker的IPv4地址
ifconfig
# 修改配置文件
vim /opt/doris/be/conf/be.conf
# 取消priority_networks的注解,并根据Docker的网段进行配置
priority_networks = 172.17.0.0/16 #这里要根据你Docker的IP确定
# 配置环境变量
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
start_be.sh --daemon
15 MySQL 登录
mysql -h 127.0.0.1 -P9030 -uroot
#这里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";
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)
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)