天天看點

redis叢集實踐+等保要求的整改方案

mkdir redis-cluster
mkdir 7001 7002
for i in 3 4;
do echo -e "port 700$i\n\
protected-mode no\n\
daemonize yes\n\
pidfile /var/run/redis_700$i.pid\n\
cluster-enabled yes\n\
cluster-config-file nodes_700$i.conf\n\
cluster-node-timeout 10100" > 700$i/redis.conf;
done
# 在等保中,往往要求綁定入口網卡,這個時候需要根據實際情況配置bind參數,bind參數的含義是:使用者可以從這些網卡進,也就是可以通路的Ip
# 建立叢集
redis-trib create --replicas 1 192.168.73.201:7001 192.168.73.201:7002 192.168.73.202:7001 192.168.73.202:7002 192.168.73.203:7001 192.168.73.203:7002
# 關閉節點的防火牆
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 7001 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 17001 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 7002 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 17002 -j ACCEPT
# 進入redisclient
redis-cli -c
# 修改密碼,注意每個節點的密碼應該保持相等
config set masterauth xxxxx
config set requirepass xxxxx
config rewrite
# 帶密碼通路叢集
redis-cli -c -p 7001 -a xxxxxx
# 設定時間戳
timedatectl set-timezone Asia/Shanghai
# redis最小權限運作 安全要求
useradd -s /sbin/nolog -M redis 
sudo -u redis //redis-server //redis.conf
# redis屏蔽關鍵方法 等保要求
rename-command CONFIG OQpWDyfcSU7784vQGJ01
rename-command FLUSHALL FKkZAWh3jhc57JciD2Bi
rename-command FLUSHDB vWk1fgSFwZroGLXSu3UD
rename-command SHUTDOWN RRAD4JLs4cAIan1BR6M6
# redis叢集打開日志審計功能,并寫入系統日志檔案中
syslog-enabled yes
syslog-ident redis
syslog-facility local0      

繼續閱讀