十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1.操作系统参数和服务配置:
sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
创新互联是一家专业提供广安企业网站建设,专注与成都网站设计、网站建设、H5建站、小程序制作等业务。10年已为广安众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。
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
关闭大页内存:
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
操作系统ntp服务设置:
#检查当前系统时区,如果不是上海,修改为上海
timedatectl |grep "Time zone"
timedatectl set-timezone Asia/Shanghai
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
安装ntp服务
yum install ntpdate -y
#写入定时任务同步时间
crontab -e
0-59/10 /usr/sbin/ntpdate ntp1.aliyun.com | logger -t NTP
#测试同步时间是否可以成功
/usr/sbin/ntpdate ntp1.aliyun.com
服务部署、依赖部署:
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
#验证是否安装成功,如果出现版本号则说明安装成功:
redis-cli -v
mkdir -p /data/redis-6379/logs/
mkdir -p /data/redis-6379/run/
编辑redis配置文件:
根据需要修改maxmemory和port参数以及对应的bind,例如端口号为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
启动Redis:
redis-server /data/redis-6379/6379.conf
登录:
redis-cli -p 6379
添加定时任务定时做rdb备份和aof备份:
0 redis-cli -p 6379 bgsave
0 1 * redis-cli -p 6379 BGREWRITEAOF