环境准备
-
安装java环境
mkdir /data/java ln -s /data/java/ /opt/ cd /opt/java tar zxvf jdk-8u171-linux-x64.tar.gz
vim /etc/profile.d/java.sh
#java export JAVA_HOME=/opt/java/jdk1.8.0_171 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
source /etc/profile java -version
-
系统优化
设置文件句柄数
cat /etc/security/limits.conf
* soft nofile 655360 * hard nofile 655360 * hard nproc 655360 * soft nproc 655360
限制一个进程可以拥有的VMA(虚拟内存区域)的数量
vim /etc/sysctl.conf
vm.max_map_count=2000000 fs.file-max=6553560
-
时间同步设置
yum -y install chrony
修改/etc/chrony.conf
server ntp1.aliyun.com iburst
启动并设置开机自启
systemctl restart chronyd systemctl enable chronyd
解压doris安装包
tar -zxvf apache-doris-2.0.1-bin-x64.tar.gz
mv apache-doris-2.0.1-bin-x64 /data/
安装FE
-
修改FE配置文件
vim /data/apache-doris-2.0.1-bin-x64/fe/conf/fe.conf #开头增加下面2行配置如下 JAVA_HOME=/opt/java/jdk1.8.0_171 priority_networks=192.168.2.0/24
-
添加FE开机自启文件
cat /etc/systemd/system/doris-fe.service
[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=/data/apache-doris-2.0.1-bin-x64/fe/bin/start_fe.sh --daemon ExecStop=/data/apache-doris-2.0.1-bin-x64/fe/bin/stop_fe.sh [Install] WantedBy=multi-user.target
-
启动FE服务
systemctl daemon-reload systemctl enable doris-fe systemctl start doris-fe
-
安装mysql客户端并连接FE
#默认密码为空 mysql -uroot -h 192.168.2.185 -P 9030 -p
mysql> show frontends\G; *************************** 1. row *************************** Name: fe_40d0bf5b_0f29_4d38_b337_8edd59a745f2 Host: 192.168.2.185 EditLogPort: 9010 HttpPort: 8030 QueryPort: 9030 RpcPort: 9020 Role: FOLLOWER IsMaster: true ClusterId: 558327065 Join: true Alive: true ReplayedJournalId: 5504 LastHeartbeat: 2023-09-27 15:18:17 IsHelper: true ErrMsg: Version: doris-2.0.1-rc04-30d35c4 CurrentConnected: Yes 1 row in set (0.02 sec)
mysql> SHOW BACKENDS\G; *************************** 1. row *************************** BackendId: 11217 Host: 192.168.2.185 HeartbeatPort: 9050 BePort: 9060 HttpPort: 8040 BrpcPort: 8060 LastStartTime: 2023-09-27 11:43:49 LastHeartbeat: 2023-09-27 15:23:42 Alive: true SystemDecommissioned: false TabletNum: 21 DataUsedCapacity: 0.000 AvailCapacity: 95.255 GB TotalCapacity: 99.947 GB UsedPct: 4.69 % MaxDiskUsedPct: 4.69 % RemoteUsedCapacity: 0.000 Tag: {"location" : "default"} ErrMsg: Version: doris-2.0.1-rc04-30d35c4 Status: {"lastSuccessReportTabletsTime":"2023-09-27 15:23:13","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} HeartbeatFailureCounter: 0 NodeRole: mix
-
添加BE节点
ALTER SYSTEM ADD BACKEND "192.168.2.185:9050";
-
删除BE节点
#强制删除BE节点,该节点数据会丢失(不建议使用) ALTER SYSTEM DROPP BACKEND "192.168.2.185:9050"; #安全删除BE节点,不保证一定执行成功 ALTER SYSTEM DECOMMISSION BACKEND "192.168.2.185:9050"; #取消安全删除BE节点 CANCEL DECOMMISSION BACKEND "192.168.2.185:9050";
-
修改密码
SET PASSWORD FOR 'root' = PASSWORD('qwer123456'); SET PASSWORD FOR 'admin' = PASSWORD('qwer123456');
安装BE
-
修改BE配置文件
vim /data/apache-doris-2.0.1-bin-x64/be/conf/be.conf #开头增加下面2行配置如下 JAVA_HOME=/opt/java/jdk1.8.0_171 priority_networks=192.168.2.0/24
-
添加BE开机自启文件
cat /etc/systemd/system/doris-be.service
[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=/data/apache-doris-2.0.1-bin-x64/be/bin/start_be.sh --daemon ExecStop=/data/apache-doris-2.0.1-bin-x64/be/bin/stop_be.sh
-
启动BE服务
systemctl daemon-reload systemctl enable doris-be systemctl start doris-be
备份
-
mysqldump备份
-
备份数据
# 由于Doris 中没有mysql 里的 tablespace 概念,因此在使用mysqldump 时要加上 --no-tablespaces 参数 # 使用mysqldump 导出数据和表结构仅用于开发测试或者数据量很小的情况,请勿用于大数据量的生产环境(小于10G) # 备份整个库dataease mysqldump -h192.168.200.60 -P9030 -uroot -p --no-tablespaces --databases dataease > dataease_20231113.sql
-
恢复数据
source dataease_20231113.sql
-
-
备份到minio
-
创建远程仓库
# 创建远程仓库,在myqsql客户端执行以下命令 # s3_repo: 仓库名(自定义) # s3://doris : doris为minio中的bucket,需提前创建好 # AWS_ENDPOINT : minio的api连接地址,注意使用http,https连接报错 # AWS_ACCESS_KEY 、 AWS_SECRET_KEY: 连接凭据,根据实际填写 CREATE REPOSITORY `s3_repo` WITH S3 ON LOCATION "s3://doris" PROPERTIES ( "AWS_ENDPOINT" = "http://192.168.1.126:9000", "AWS_ACCESS_KEY" = "hKdfgdfgfsMuzFJQUV", "AWS_SECRET_KEY" = "TrnwAuufgfgssdgsdgbu8avKiM4Ggr0", "AWS_REGION" = "REGION", "use_path_style" = "true" ); # 查看仓库 show repositories; # 删除仓库 DROP REPOSITORY `minio_repo`;
-
备份数据
# s3_repo : 备份到的远程仓库 # dataease.snapshot_dataease_2023_11_14_2: dataease为要备份的库名,dataease.snapshot_dataease_2023_11_14_2为自定义的备份镜像名 BACKUP SNAPSHOT dataease.snapshot_dataease_2023_11_14_2 TO s3_repo; # 查看备份 use dataease; show backup\G; # 取消备份任务 CANCEL BACKUP FROM dataease;
-
恢复数据
RESTORE SNAPSHOT dataease.snapshot_dataease_2023_11_14_3 FROM `s3_repo` PROPERTIES ( "backup_timestamp"="2023-11-14-11-45-25", "replication_num" = "1" );
-