用户工具

站点工具


侧边栏

1.bi与可视化saca.dataviz:8运维:8.21clickhouse数据磁盘迁移

这是本文档旧的修订版!


8.19clickhouse数据磁盘迁移

data_dir=/usr/local/data/clickhouse
mkdir -p $data_dir
####复制数据目录到新的路径
cp /var/lib/clickhouse/data -r $data_dir
cp /var/lib/clickhouse/flags -r $data_dir
cp /var/lib/clickhouse/format_schemas -r $data_dir
cp /var/lib/clickhouse/metadata -r $data_dir
cp /var/lib/clickhouse/preprocessed_configs -r $data_dir
cp /var/lib/clickhouse/tmp -r $data_dir
cp /var/lib/clickhouse/user_files -r $data_dir
####删除原来文件夹的文件
rm -rf /var/lib/clickhouse/data
rm -rf /var/lib/clickhouse/flags
rm -rf /var/lib/clickhouse/format_schemas
rm -rf /var/lib/clickhouse/metadata
rm -rf /var/lib/clickhouse/preprocessed_configs
rm -rf /var/lib/clickhouse/tmp
rm -rf /var/lib/clickhouse/user_files
####建立软连接
ln -s  $data_dir/data  /var/lib/clickhouse
ln -s  $data_dir/flags  /var/lib/clickhouse
ln -s  $data_dir/format_schemas /var/lib/clickhouse
ln -s  $data_dir/metadata  /var/lib/clickhouse
ln -s  $data_dir/preprocessed_configs  /var/lib/clickhouse
ln -s  $data_dir/tmp  /var/lib/clickhouse
ln -s  $data_dir/user_files  /var/lib/clickhouse
####给新的路径添加权限
chown -R clickhouse.clickhouse $data_dir
####重启clickhouse
sudo /etc/init.d/clickhouse-server restart
/var/www/html-133/wiki/data/attic/1.bi与可视化saca.dataviz/8运维/8.21clickhouse数据磁盘迁移.1617004596.txt.gz · 最后更改: 2021/03/29 15:56 由 admin