1.操作系統(tǒng)參數(shù)和服務(wù)配置:
sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
echo "vm.overcommit_memory=1" >> /etc/sysctl.conf
echo "vm.swappiness=10" >> /etc/sysctl.conf
echo 10 > /proc/sys/vm/swappiness
echo "net.core.somaxconn=65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_syn_backlog=65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_syn_backlog=65535" >> /etc/sysctl.conf
echo "net.core.somaxconn=65535" >> /etc/sysctl.conf
echo " soft nofile 288000" >> /etc/security/limits.conf
echo " hard nofile 288000" >> /etc/security/limits.conf
sysctl -p
關(guān)閉大頁(yè)內(nèi)存:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.d/rc.local
chmod a+x /etc/rc.d/rc.local
操作系統(tǒng)ntp服務(wù)設(shè)置:
#檢查當(dāng)前系統(tǒng)時(shí)區(qū),如果不是上海,修改為上海
timedatectl |grep "Time zone"
timedatectl set-timezone Asia/Shanghai
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
安裝ntp服務(wù)
yum install ntpdate -y
#寫(xiě)入定時(shí)任務(wù)同步時(shí)間
crontab -e
0-59/10 /usr/sbin/ntpdate ntp1.aliyun.com | logger -t NTP
#測(cè)試同步時(shí)間是否可以成功
/usr/sbin/ntpdate ntp1.aliyun.com
服務(wù)部署、依賴部署:
yum install gcc wget -y
2.redis軟件下載及安裝:
cd /usr/local
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar xvzf redis-4.0.11.tar.gz
ln -s redis-4.0.11 redis
cd redis
make
make install
cd ~
vim .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/redis/src
source .bash_profile
#驗(yàn)證是否安裝成功,如果出現(xiàn)版本號(hào)則說(shuō)明安裝成功:
redis-cli -v
mkdir -p /data/redis-6379/logs/
mkdir -p /data/redis-6379/run/
編輯redis配置文件:
根據(jù)需要修改maxmemory和port參數(shù)以及對(duì)應(yīng)的bind,例如端口號(hào)為6379,sed -i 's/6379/xxxx/g' xxxx.conf
配置文件port6379,IP地址192.168.56.201:
bind 127.0.0.1 192.168.56.201
protected-mode no
port 6379
tcp-backlog 10000
timeout 0
tcp-keepalive 60
daemonize yes
supervised no
pidfile "/data/redis-6379/run/redis_6379.pid"
loglevel notice
logfile "/data/redis-6379/logs/6379.log"
databases 16
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump6379.rdb"
dir "/data/redis-6379"
#slaveof 192.168.56.201 6379 #master ip地址和端口
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-timeout 60
repl-disable-tcp-nodelay no
repl-backlog-size 10mb
repl-backlog-ttl 3600
slave-priority 100
maxclients 10000
maxmemory 5000000kb
maxmemory-policy volatile-lru
appendonly yes
appendfilename "appendonly6379.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 0
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 1000
slowlog-max-len 1000
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 512mb 128mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
啟動(dòng)Redis:
redis-server /data/redis-6379/6379.conf
登錄:
redis-cli -p 6379
添加定時(shí)任務(wù)定時(shí)做rdb備份和aof備份:
0 redis-cli -p 6379 bgsave
0 1 * redis-cli -p 6379 BGREWRITEAOF
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
本文名稱:redis安裝配置參考-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)源:http://jinyejixie.com/article34/ddeepe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、全網(wǎng)營(yíng)銷推廣、App設(shè)計(jì)、網(wǎng)站建設(shè)、靜態(tài)網(wǎng)站、小程序開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容
營(yíng)銷型網(wǎng)站建設(shè)知識(shí)