Centos7安装Doris
安装环境
-
安装java>=1.8环境
参考: -
安装gcc
sudo yum install gcc
# 查看GCC版本(>=4.8.2) gcc -v # 安装并查看JAVA版本(>=1.8) java - version
-
设置系统最大打开文件句柄数
vi /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536
-
关闭交换分区(swap)
Linux交换分区会给Doris带来很严重的性能问题,需要在安装之前禁用交换分区。
# 使用不重启的方式,禁用swap,立即生效 sudo swap -a sudo free -m
-
关闭防火墙
systemctl status firewalld.service systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld.service
1. 下载安装包
下载地址:https://doris.apache.org/download
将安装包上传到虚拟机上/opt目录下,解压安装包
mkdir /usr/local/doris
tar -zxvf /opt/apache-doris-2.0.3-bin-x64.tar.gz -C /usr/local/doris
2. 配置doris环境变量
sudo vi /etc/profile.d/myprofile.sh
//添加配置
export DORIS_HOME=/usr/local/doris/apache-doris-2.0.3-bin-x64
export PATH=$DORIS_HOME/bin:$PATH
source /etc/profile
3. 配置fe
mkdir /usr/local/doris/apache-doris-2.0.3-bin-x64/fe_meta
cd $DORIS_HOME/fe && vi conf/fe.conf
配置属性:
// 这里需要填入的是 IP 子网网段地址,并非 IP 地址
//例如当前节点的 IP 地址为 10.10.2.21,则需要更改为 10.10.2.0/24 填入
priority_networks=xx.xx.xx.xx/24
meta_dir=/usr/local/doris/apache-doris-2.0.3-bin-x64/fe_meta
启动/停止fe:
$DORIS_HOME/fe/bin/start_fe.sh --daemon
$DORIS_HOME/fe/bin/stop_fe.sh
验证fe是否启动成功:
curl http://127.0.0.1:58030/api/bootstrap
4. 配置be
mkdir /usr/local/doris/apache-doris-2.0.3-bin-x64/be_data
cd $DORIS_HOME/be && vi conf/be.conf
#配置下面两个属性
priority_networks=xxx.xx.xx.xx/24
storage_root_path=/usr/local/doris/apache-doris-2.0.3-bin-x64/be_data
sudo sysctl -w vm.max_map_count=2000000
sudo sh -c "ulimit -n 65535 && exec su $LOGNAME"
sudo swapoff -a
#启动/停止be
$DORIS_HOME/be/bin/start_be.sh --daemon
$DORIS_HOME/be/bin/stop_be.sh
#连接mysql 客户端,使用命令将be加入到集群中
#-P: the default port is 9030, which corresponds to `query_port` in fe.conf
#-h: Here is the IP address of the FE we are connecting to, if your client and FE are installed on the same node you can use 127.0.0.1
mysql -uroot -Pxxx -h xx.xx.xx.xx (-p(设置密码后))
#`heartbeat_service_port` in `be.conf`, default is `9050`
ALTER SYSTEM ADD BACKEND "xx.xx.xx.xx:heartbeat_service_port";
#查看be状态
SHOW BACKENDS\G;
#查看fe运行状态
show frontends\G;
#doris root账户设置密码
SET PASSWORD FOR 'root' = PASSWORD('xxx');
5. doris建库建表
create database doris_database;
use doris_database;
CREATE TABLE IF NOT EXISTS doris_database.tablel_name
(
`id` LARGEINT NOT NULL COMMENT "id",
`name` VARCHAR(64) COMMENT "",
`description` VARCHAR(64) COMMENT ""
)
AGGREGATE KEY(`id`, `name`, `description`)
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);