当前位置: 首页 > 工具软件 > scylla > 使用案例 >

Scylla && AntDB 安装

云正信
2023-12-01

1 ScyllaDB安装

1.1 下载安装包

  找一台能联网的主机,执行命令:

curl -o /etc/yum.repos.d/scylla.repo -L http://repositories.scylladb.com/scylla/repo/e4c98290-5e67-42bd-b592-f5e933d2543b/centos/scylladb-3.0.repo
mkdir -p /data/scylla-3.0
yum install -y scylla --downloadonly --downloaddir=/data/scylla-3.0

  拷贝安装包到yum源服务器192.168.137.129:/var/ftp/pub/scylla-3.0.4,执行命令

cd /var/ftp/pub/scylla-3.0.4
createrepo .

1.2 编写初始化脚本

installScylla.sh

#!/bin/bash
echo "#### config scylla-3.0.4 yum ####"
cat << EOF > /etc/yum.repos.d/scylla-3.0.4.repo
[scylla-3.0.4]
name=scylla-3.0.4
baseurl=ftp://192.168.137.129/pub/scylla-3.0.4/
enabled=1
gpgcheck=0
gpgkey=
EOF
chmod 644 /etc/yum.repos.d/scylla-3.0.4.repo
echo "#### config yum Done ####"
echo ""
echo "#### install scylla package ####"
yum install -y scylla
echo "#### install package Done ####"

initScylla.sh

#!/bin/bash
ip_list="192.168.137.129,192.168.137.130,192.168.137.131"
host_ip=`hostname -i`
cp -p /etc/scylla/scylla.yaml /etc/scylla/scylla.yaml.oringin
echo "#### config cluster_name ####"
sed -i "s/#cluster_name: 'Test Cluster'/cluster_name: 'sae_scylla'/" /etc/scylla/scylla.yaml
echo "cluster_name  ******************  sae_scylla"
echo "#### config cluster_name Done ####"
echo ""
echo "#### config seeds ####"
sed -i "s/seeds: \"127.0.0.1\"/seeds: \"${ip_list}\"/" /etc/scylla/scylla.yaml
echo "seeds  ******************  ${ip_list}"
echo "#### config seeds Done ####"
echo ""
echo "#### config listen_address ####"
sed -i "s/listen_address: localhost/listen_address: ${host_ip}/" /etc/scylla/scylla.yaml
echo "listen_address  ******************  ${host_ip}"
echo "#### config listen_address Done ####"
echo ""
echo "#### config rpc_address ####"
sed -i "s/rpc_address: localhost/rpc_address: ${host_ip}/" /etc/scylla/scylla.yaml
echo "rpc_address  ******************  ${host_ip}"
echo "#### config rpc_address Done ####"
echo ""
echo "#### config api_address ####"
sed -i "s/api_address: 127.0.0.1/api_address: ${host_ip}/" /etc/scylla/scylla.yaml
echo "api_address  ******************  ${host_ip}"
echo "#### config api_address Done ####"

uninstallScylla.sh

#!/bin/bash
echo "#### uninstall scylla packages ####"
yum remove -y scylla*
echo "#### uninstall scylla packages Done ####"
echo ""
echo "#### rm scylla config files ####"
rm -rf /etc/scylla/
rm -rf /var/lib/scylla/
rm -rf /usr/lib/scylla/
rm -rf /usr/share/scylla/
rm -rf /opt/scylladb/
rm -rf /var/lib/scylla-housekeeping
rm -rf /etc/security/limits.d/scylla.conf
rm -rf /etc/profile.d/scylla.csh
rm -rf /etc/profile.d/scylla.sh
rm -rf /etc/sysconfig/scylla-server
rm -rf /etc/sysconfig/scylla-jmx
rm -rf /etc/sysconfig/irqbalance.scylla.orig
rm -rf /etc/ld.so.conf.d/scylla.x86_64.conf
rm -rf /etc/sysctl.d/99-scylla-coredump.conf
rm -rf /etc/systemd/system/multi-user.target.wants/scylla-server.service
rm -rf /etc/systemd/system/multi-user.target.wants/scylla-jmx.service
rm -rf /etc/systemd/system/scylla-server.service.d
rm -rf /etc/scylla.d
rm -rf /usr/bin/scylla-sstableloader
rm -rf /usr/bin/scylla
rm -rf /usr/bin/scyllatop
rm -rf /usr/sbin/scylla_cpuset_setup
rm -rf /usr/sbin/scylla_bootparam_setup
rm -rf /usr/sbin/scylla_ec2_check
rm -rf /usr/sbin/scylla_fstrim_setup
rm -rf /usr/sbin/scylla_io_setup
rm -rf /usr/sbin/scylla_kernel_check
rm -rf /usr/sbin/scylla_ntp_setup
rm -rf /usr/sbin/scylla_coredump_setup
rm -rf /usr/sbin/scylla_raid_setup
rm -rf /usr/sbin/scylla_selinux_setup
rm -rf /usr/sbin/scylla_setup
rm -rf /usr/sbin/scylla_cpuscaling_setup
rm -rf /usr/sbin/scylla_dev_mode_setup
rm -rf /usr/sbin/scylla_sysconfig_setup
rm -rf /usr/lib/systemd/system/scylla-fstrim.timer
rm -rf /usr/lib/systemd/system/scylla-server.service
rm -rf /usr/lib/systemd/system/scylla-fstrim.service
rm -rf /usr/lib/systemd/system/scylla-jmx.service
rm -rf /usr/lib/systemd/system/scylla-housekeeping-daily.service
rm -rf /usr/lib/systemd/system/scylla-housekeeping-daily.timer
rm -rf /usr/lib/systemd/system/scylla-housekeeping-restart.service
rm -rf /usr/lib/systemd/system/scylla-housekeeping-restart.timer
rm -rf /usr/lib/sysctl.d/99-scylla-aio.conf
rm -rf /usr/lib/sysctl.d/99-scylla-sched.conf
rm -rf /usr/share/doc/scylla
echo "#### rm scylla config files Done ####"
echo ""
echo "#### reboot after 30s ####"
sleep 30s
reboot

1.3 安装Scylla

curl -s -L http://192.168.137.129:18080/scylla/installScylla.sh | bash
curl -s -L http://192.168.137.129:18080/scylla/initScylla.sh | bash
scylla_setup

> install node exporter: no
> others: YES

chmod 644 /etc/scylla.d/io_properties.yaml
sed -i "s/queues\=1/queues\=8/" /etc/scylla.d/io.conf
systemctl start scylla-server
systemctl start scylla-jmx
systemctl enable scylla-server
systemctl enable scylla-jmx
nodetool status

cqlsh 192.168.137.129 9042
cassandra-stress write -mode cql3 native -node 192.168.137.129

1.4 卸载Scylla

curl -s -L http://192.168.137.129:18080/scylla/uninstallScylla.sh | bash

2 AntDB安装

2.1 下载安装包

  拷贝安装包到yum源服务器192.168.137.129:/var/ftp/pub/antdb-4.0,执行命令

cd /var/ftp/pub/antdb-4.0
createrepo .

2.2 编写初始化脚本

installAntDB.sh

#!/bin/bash
echo "#### config antdb-4.0 yum ####"
cat << EOF > /etc/yum.repos.d/antdb-4.0.repo
[antdb-4.0]
name=antdb-4.0
baseurl=ftp://192.168.137.129/pub/antdb-4.0/
enabled=1
gpgcheck=0
gpgkey=
EOF
echo "#### Config yum Done ####"
echo ""
echo "#### install scylla package ####"
yum install -y antdb
echo "#### install package Done ####"

initAntDB.sh

#!/bin/bash
set -e
echo "#### create adb user ####"
groupadd -g 4001 adb && useradd -g adb -u 4001 -d /home/adb -m adb && echo adb:adb1234 | chpasswd
echo "#### create adb user Done ####"
echo ""
echo "#### mkdir data_dir ####"
ADB_DATA_PATH="/data/adb"
mkdir -p ${ADB_DATA_PATH}/mgr
mkdir -p ${ADB_DATA_PATH}/adb_data/coord/0000
mkdir -p ${ADB_DATA_PATH}/adb_data/coord/0001
mkdir -p ${ADB_DATA_PATH}/adb_data/datanode/M0000
mkdir -p ${ADB_DATA_PATH}/adb_data/datanode/M0001
mkdir -p ${ADB_DATA_PATH}/adb_data/datanode/S0000
mkdir -p ${ADB_DATA_PATH}/adb_data/datanode/S0001
mkdir -p ${ADB_DATA_PATH}/adb_data/gtm/M0000
mkdir -p ${ADB_DATA_PATH}/adb_data/gtm/S0000
chown -R adb:adb ${ADB_DATA_PATH}
echo "#### mkdir data_dir Done ####"
echo ""
echo "#### set env ####"
su - adb
ADB_DATA_PATH="/data/adb"
chmod -R 700 ${ADB_DATA_PATH}
echo 'export ADBHOME=/opt/app/adb' >> ~/.bashrc
echo 'export PATH=$ADBHOME/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$ADBHOME/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
echo "#### set env Done ####"
echo ""
echo "#### start AntDB ####"
initmgr -D ${ADB_DATA_PATH}/mgr
sed -i "s/#port =/port =/" ${ADB_DATA_PATH}/mgr/postgresql.conf
nohup adbmgrd -D ${ADB_DATA_PATH}/mgr &
echo "#### AntDB started !!! ####"

uninstallAntDB.sh

#!/bin/bash
ADB_DATA_PATH="/data/adb"
echo "#### kill AntDB progress ####"
ps -ef| grep adbmgr | awk -F " " '{print $2}' | xargs kill -9
ps -ef| grep postgres | awk -F " " '{print $2}' | xargs kill -9
echo "#### kill AntDB progress Done ####"
echo ""
echo "#### uninstall AntDB packages ####"
yum remove -y antdb*
echo "#### uninstall AntDB packages Done ####"
echo ""
echo "#### delete adb user ####"
userdel -r adb
echo "#### delete adb user Done ####"
echo ""
echo "#### rm AntDB config and data files ####"
rm -rf /opt/app/adb
rm -rf ${ADB_DATA_PATH}
echo "#### rm AntDB config and data files Done ####"
echo ""
echo "#### reboot after 30s ####"
sleep 30s
reboot

2.3 安装AntDB

curl -s -L http://192.168.137.129:18080/antdb/installAntDB.sh | bash
curl -s -L http://192.168.137.129:18080/antdb/initAntDB.sh | bash

2.4 配置AntDB

su - adb
psql -d postgres -p 5432
> add host db137129(port=22,protocol='ssh',adbhome='/opt/app/adb',address="192.168.137.129",agentport=8432,user='adb');
> add host db137130(port=22,protocol='ssh',adbhome='/opt/app/adb',address="192.168.137.130",agentport=8432,user='adb');
> add host db137131(port=22,protocol='ssh',adbhome='/opt/app/adb',address="192.168.137.131",agentport=8432,user='adb');
> list host;
> deploy all password 'adb1234';
> start agent all password 'adb1234';
> add coordinator master coord0(path = '/data/adb/adb_data/coord/0000', host='db137129', port=4332);
> add coordinator master coord1(path = '/data/adb/adb_data/coord/0001', host='db137130', port=4332);
> add datanode master datanode0m(path = '/data/adb/adb_data/datanode/M0000', host='db137129', port=14332);
> add datanode slave datanode0s for datanode0m(host='db137130',port=14332,path='/data/adb/adb_data/datanode/S0000');
> add datanode master datanode1m(path = '/data/adb/adb_data/datanode/M0001', host='db137130', port=24332);
> add datanode slave datanode1s for datanode1m(host='db137129',port=24332,path='/data/adb/adb_data/datanode/S0001');
> add gtm master gtm0m(host='db137131',port=6655, path='/data/adb/adb_data/gtm/M0000');
> add gtm slave gtm0s for gtm0m(host='db137130',port=6655,path='/data/adb/adb_data/gtm/S0000');
> list node;
> init all data_checksums;
> monitor all;

2.5 卸载AntDB

curl -s -L http://192.168.137.129:18080/antdb/uninstallAntDB.sh | bash

 类似资料: