云服务器Doris分析型数据库部署

一、环境准备

1. 系统配置

bash
# 系统参数优化
cat >> /etc/sysctl.conf << EOF
vm.swappiness = 0
vm.max_map_count = 2000000
net.core.somaxconn = 65535
EOF

sysctl -p

# 修改系统限制
cat >> /etc/security/limits.conf << EOF
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
EOF

2. 依赖安装

bash
# 安装必要依赖
apt update
apt install -y \
mysql-client \
gcc \
cmake \
byacc \
flex \
automake \
libtool \
binutils-dev \
libiberty-dev \
bison \
python

二、Doris安装

1. 编译安装

bash
# 下载源码
git clone https://github.com/apache/doris.git
cd doris

# 编译
./build.sh

2. 目录配置

bash
# 创建必要目录
mkdir -p /opt/doris/fe/meta
mkdir -p /opt/doris/be/storage
mkdir -p /opt/doris/fe/log
mkdir -p /opt/doris/be/log

# 设置权限
chown -R doris:doris /opt/doris

三、FE节点配置

1. FE配置文件

properties
# fe.conf
JAVA_OPTS="-Xmx8192m -XX:+UseG1GC"
meta_dir = /opt/doris/fe/meta
http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010

2. 启动FE

bash
# 启动FE节点
bin/start_fe.sh --daemon

# 检查启动状态
curl http://localhost:8030/api/bootstrap

四、BE节点配置

1. BE配置文件

properties
# be.conf
PPROF_TMPDIR="/tmp"
BE_LOG_DIR = /opt/doris/be/log
storage_root_path = /opt/doris/be/storage
default_rowset_type = BETA
write_buffer_size = 134217728
max_tablet_num_per_shard = 1024

2. BE节点部署

bash
# 启动BE节点
bin/start_be.sh --daemon

# 添加BE节点到集群
mysql -h 127.0.0.1 -P 9030 -u root
> ALTER SYSTEM ADD BACKEND "host:port";

五、集群管理

1. 节点管理

sql
-- 查看节点状态
SHOW PROC '/backends';

-- 下线BE节点
ALTER SYSTEM DECOMMISSION BACKEND "host:port";

2. 表管理

sql
-- 创建数据库
CREATE DATABASE example_db;

-- 创建表
CREATE TABLE example_tbl (
id BIGINT,
name VARCHAR(32),
score DECIMAL(10,2)
)
DISTRIBUTED BY HASH(id) BUCKETS 10
PROPERTIES (
"replication_num" = "3"
);

六、性能优化

1. 内存配置

properties
# fe.conf内存优化
heap_size = 8192
write_buffer_size = 134217728

# be.conf内存优化
chunk_reserved_bytes_limit = 2147483648
max_compaction_concurrency = 4

2. 查询优化

sql
-- 设置查询超时时间
SET query_timeout = 3600;

-- 并行度设置
SET parallel_fragment_exec_instance_num = 8;

七、监控配置

1. 监控指标

yaml
# prometheus.yml
scrape_configs:
- job_name: 'doris_fe'
static_configs:
- targets: ['localhost:8030']
- job_name: 'doris_be'
static_configs:
- targets: ['localhost:8040']

2. 告警配置

yaml
# alert.rules
groups:
- name: doris_alerts
rules:
- alert: DorisNodeDown
expr: up == 0
for: 5m
labels:
severity: critical

最佳实践建议

  1. 集群规划
  • FE节点部署奇数个
  • BE节点均衡分布
  • 合理规划分片数
  • 配置副本策略
  1. 性能优化
  • 合理设置内存
  • 优化查询计划
  • 配置数据分布
  • 管理并发查询
  1. 运维建议
  • 定期备份元数据
  • 监控系统资源
  • 及时清理日志
  • 版本升级规划

本指南为您提供了在云服务器上部署Doris分析型数据库的完整方案。记住,Doris的性能优化是一个持续的过程,需要根据实际业务场景和数据特点不断调整。建议在正式部署前进行充分的测试和性能评估。

温馨提示:

  1. 保持版本更新
  2. 关注性能监控
  3. 做好数据备份
  4. 优化查询性能

对于生产环境的Doris集群,建议建立完善的监控系统,确保能够及时发现和处理性能问题。同时,要做好数据备份和恢复演练,确保系统的可靠性。

实操指南知识库

云服务器Hudi数据湖平台搭建

2024-12-17 14:57:02

实操指南知识库

云服务器GitLab-CI持续集成环境搭建

2024-12-17 17:03:33

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧