Apache Doris是基于MPP架构的新一代开源实时数据仓库,使用更方便,性能更高,适用于大数据分析。
快速开始
Doris 介绍
标准部署 - Apache Doris
弹性扩缩容 - Apache Doris
Download - Apache Doris
ALTER-SYSTEM-DROP-BACKEND - Apache Doris
弹性扩缩容 - Apache Doris
CentOS基础操作命令
CentOS对换home分区与root分区的存储空间
CentOS7安装部署Java11
CentOS7安装部署MySQL80
Doris 介绍
FE(Frontend)主要负责元数据的管理、存储,以及查询的解析等
BE(Backend)则主要负责数据的存储、以及查询计划的执行。BE 中的每个节点都存储有数据的多副本,从而保证数据的高可用和高可靠
标准部署 - Apache Doris
实例名称 | 端口名称 | 默认端口 | 通讯方向 | 说明 |
---|---|---|---|---|
BE | be_port | 9060 | FE --> BE | BE 上 thrift server 的端口,用于接收来自 FE 的请求 |
BE | webserver_port | 8040 | BE <–> BE | BE 上的 http server 的端口 |
BE | heartbeat_service_port | 9050 | FE --> BE | BE 上心跳服务端口(thrift),用于接收来自 FE 的心跳 |
BE | brpc_port | 8060 | FE <–> BE, BE <–> BE | BE 上的 brpc 端口,用于 BE 之间通讯 |
FE | http_port | 8030 | FE <–> FE,用户 <–> FE | FE 上的 http server 端口 |
FE | rpc_port | 9020 | BE --> FE, FE <–> FE | FE 上的 thrift server 端口,每个fe的配置需要保持一致 |
FE | query_port | 9030 | 用户 <–> FE | FE 上的 mysql server 端口 |
FE | edit_log_port | 9010 | FE <–> FE | FE 上的 bdbje 之间通信用的端口 |
Broker | broker_ipc_port | 8000 | FE --> Broker, BE --> Broker | Broker 上的 thrift server,用于接收请求 |
meta_dir = ${DORIS_HOME}/doris-meta
storage_root_path = ${DORIS_HOME}/storage
集群名 | IP 地址 | 实例 |
---|---|---|
Doris001 | 192.168.8.111 | FE |
Doris002 | 192.168.8.112 | BE |
Doris003 | 192.168.8.113 | BE |
在3 台服务器上执行基础环境的安装和配置
/opt/java/jdk-11.0.19
yum -y install gcc
gcc --version
设置系统最大打开文件句柄数
编辑 limits.conf
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 204800
* hard nproc 204800
ulimit -n
swapon --show
# 备用:打开交换分区:swapon -a
swapoff -a
/etc/fstab
vim /etc/fstab
# /dev/mapper/centos-swap swap swap defaults 0 0
#安装rdate
yum -y install rdate
#同步时间
rdate -s time-b.nist.gov
#查看时间是否正确
date
yum -y install crontab
crontab -e
*/20 * * * * /usr/bin/rdate -s time-b.nist.gov > /dev/null 2>&1
service crond reload
节点位置 | 节点域名 |
---|---|
东南大学 | s1d.time.edu.cn |
清华大学 | s1e.time.edu.cn |
清华大学 | s2a.time.edu.cn |
清华大学 | s2b.time.edu.cn |
北京邮电大学 | s2c.time.edu.cn |
上海交通大学 | ntp.sjtu.edu.cn |
北京邮电大学 | s1a.time.edu.cn |
北京大学 | s1c.time.edu.cn |
香港中文大学 | clock.cuhk.edu.hk |
#--关闭防火墙
systemctl stop firewalld.service
#--开机禁用防火墙
systemctl disable firewalld.service
#--防火墙状态
systemctl status firewalld.service
FE 服务器:192.168.8.111
mkdir /opt/doris
cd /opt/doris
1.2.4.1
Download - Apache Doris
wget https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-1.2.4.1-bin-x86_64.tar.xz
tar -xvf apache-doris-1.2.4.1-bin-x86_64.tar.xz
/opt/doris/
mv /opt/doris/apache-doris-1.2.4.1-bin-x86_64/fe/ /opt/doris/
vim ./fe/conf/fe.conf
# JAVA_OPTS 上面一行
JAVA_HOME=/opt/java/jdk-11.0.19
priority_networks=192.168.8.111/24
cd /opt/doris
./fe/bin/start_fe.sh --daemon
浏览器访问:http://192.168.8.111:8030/api/bootstrap
成功提示
{"msg":"success","code":0,"data":{"replayedJournalId":0,"queryPort":0,"rpcPort":0,"version":""},"count":0}
FE 服务器:192.168.8.111
scp -r /opt/doris/apache-doris-1.2.4.1-bin-x86_64/be [email protected]:/opt/doris
scp -r /opt/doris/apache-doris-1.2.4.1-bin-x86_64/be [email protected]:/opt/doris
BE 服务器:192.168.8.112、192.168.8.113
mkdir /opt/doris
cd /opt/doris
vim ./be/conf/be.conf
# JAVA_OPTS 上面一行
JAVA_HOME=/opt/java/jdk-11.0.19
priority_networks=192.168.8.112/24
vim /etc/sysctl.conf
vm.max_map_count=2000000
fs.file-max=6553560
sysctl -p
./be/bin/start_be.sh --daemon
浏览器访问
http://192.168.8.114:8040/api/health
http://192.168.8.115:8040/api/health
成功提示
{"status": "OK","msg": "To Be Added"}
可忽略,使用 Navicat 替代
FE 服务器:192.168.8.111
mkdir /opt/mysql
cd /opt/mysql
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-common-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-libs-8.0.25-1.el7.x86_64.rpm
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-community-client-8.0.25-1.el7.x86_64.rpm
rpm -Uvh *.rpm --nodeps --force
mysql -h 192.168.8.111 -P 9030 -uroot -p
弹性扩缩容 - Apache Doris
#--备用(删除BE节点):ALTER SYSTEM DROPP BACKEND "192.168.8.112:9050";
ALTER SYSTEM ADD BACKEND "192.168.8.112:9050";
ALTER SYSTEM ADD BACKEND "192.168.8.113:9050";
SET PASSWORD FOR 'root' = PASSWORD('doris123');
create database demo;
CREATE TABLE IF NOT EXISTS example_tb
(
`user_id` LARGEINT NOT NULL COMMENT "用户id",
`date` DATE NOT NULL COMMENT "数据灌入日期时间",
`city` VARCHAR(20) COMMENT "用户所在城市",
`age` SMALLINT COMMENT "用户年龄",
`sex` TINYINT COMMENT "用户性别",
`last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",
`cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
`max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
`min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
)
AGGREGATE KEY(`user_id`, `date`, `city`, `age`, `sex`)
DISTRIBUTED BY HASH(`user_id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
desc example_tb;
insert into example_tb values
(10000,"2017-10-01","北京",20,0,"2017-10-01 06:00:00",20,10,10),
(10000,"2017-10-01","北京",20,0,"2017-10-01 07:00:00",15,2,2),
(10001,"2017-10-01","北京",30,1,"2017-10-01 17:05:45",2,22,22),
(10002,"2017-10-02","上海",20,1,"2017-10-02 12:59:12",200,5,5),
(10003,"2017-10-02","广州",32,0,"2017-10-02 11:20:00",30,11,11),
(10004,"2017-10-01","深圳",35,0,"2017-10-01 10:00:15",100,3,3),
(10004,"2017-10-03","深圳",35,0,"2017-10-03 10:20:22",11,6,6);
SELECT * FROM example_tb;
服务自动拉起
doris-fe.service
vim /etc/systemd/system/doris-fe.service
ExecStart
和 ExecStop
)[Unit]
Description=Doris FE
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
User=root
Group=root
LimitCORE=infinity
LimitNOFILE=200000
Restart=on-failure
RestartSec=30
StartLimitInterval=120
StartLimitBurst=3
KillMode=none
ExecStart=/opt/doris/fe/bin/start_fe.sh --daemon
ExecStop=/opt/doris/fe/bin/stop_fe.sh
[Install]
WantedBy=multi-user.target
doris-be.service
vim /etc/systemd/system/doris-be.service
ExecStart
和 ExecStop
)[Unit]
Description=Doris BE
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
User=root
Group=root
LimitCORE=infinity
LimitNOFILE=200000
Restart=on-failure
RestartSec=30
StartLimitInterval=120
StartLimitBurst=3
KillMode=none
ExecStart=/opt/doris/be/bin/start_be.sh --daemon
ExecStop=/opt/doris/be/bin/stop_be.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start doris-fe
systemctl start doris-be
systemctl enable doris-fe
systemctl enable doris-be
systemctl status doris-fe
systemctl status doris-be