CentOS 7系统Redis安装步骤

发布时间:2024-02-29 点击:105
remote dictionary server(redis) 是一个由salvatore sanfilippo写的key-value存储系统。redis是一个开源的使用ansi c语言编写、遵守bsd协议、支持网络、可基于内存亦可持久化的日志型、key-value数据库,并提供多种语言的api。它通常被称为数据结构服务器,因为值(value)可以是 字符串(string), 哈希(map), 列表(list), 集合(sets) 和 有序集合(sorted sets)等类型。redis安装比较简单,下面就在centos 7 中安装,步骤如下。
下载mkdir -pv /root/softbakwget http://download.redis.io/releases/redis-4.0.11.tar.gz -o redis-4.0.11.tar.gzcd /root/softbak新建用户groupadd redisuseradd -g redis redis安装# 创建目录mkdir -pv /usr/local/redismkdir -pv /usr/local/redis/binmkdir -pv /usr/local/redis/confmkdir -pv /usr/local/redis/logschown -r redis:redis /usr/local/redis# 解压安装yum install gcc makecd /root/softbaktar zxf redis-4.0.11.tar.gzcd redis-4.0.11/make malloc=libc# 复制cd srccp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server redis-sentinel redis-trib.rb /usr/local/redis/bincd ..cp redis.conf /usr/local/redis/conf配置# 环境变量cat >>/etc/profile<<eofexport path=/usr/local/redis/bin:\\$patheofsource /etc/profile# 修改 redis.confsed -i \s@bind 127.0.0.1@bind 0.0.0.0@g\ /usr/local/redis/conf/redis.confsed -i \s@daemonize no@daemonize yes@g\ /usr/local/redis/conf/redis.confsed -i \s@redis_6379.pid@redis.pid@g\ /usr/local/redis/conf/redis.confsed -i \s@logfile \\\\\\@logfile \\\/usr/local/redis/logs/redis.log\\\@g\ /usr/local/redis/conf/redis.confsed -i \s@dir ./@dir /usr/local/redis@g\ /usr/local/redis/conf/redis.conf优化1、somaxconn该内核参数默认值一般是128(定义了系统中每一个端口最大的监听队列的长度),对于负载很大的服务程序来说大大的不够。一般会将它修改为2048或者更大。
warning: the tcp backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.修改:net.core.somaxconn=2048
2、overcommit_memorywarning overcommit_memory is set to 0! background save may fail under low memory condition. to fix this issue add \'vm.overcommit_memory = 1\' to /etc/sysctl.conf and then reboot or run the command \'sysctl vm.overcommit_memory=1\' for this to take effect.修改:vm.overcommit_memory=1
3、thp# warning you have transparent huge pages (thp) support enabled in your kernel. this will create latency and memory usage issues with redis. to fix this issue run the command \'echo never > /sys/kernel/mm/transparent_hugepage/enabled\' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. redis must be restarted after thp is disabled.修改:/etc/rc.local,增加 echo never > /sys/kernel/mm/transparent_hugepage/enabled 。
性能参数的参考网址: https://www.techandme.se/performance-tips-for-redis-cache-server/
systemd启动最后上个systemd启动的配置文件。
[unit]description=redis serverafter=syslog.target network.target [service]type=notifypidfile=/usr/local/redis/var/redis.pidkillmode=processuser=redisgroup=redislimitnofile=65000execstart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf --supervised systemdexecstop=/bin/kill -sigterm $mainpid [install]wantedby=multi-user.target

.top什么类型域名?域名top使用人群多吗?
云服务器免费买哪个好
华为云服务器安装本地镜像
我最初是在阿里云备案的这个网站
阿里云服务器可放网站数量
域名在我们生活中有什么作用?怎么查域名有没有被注册呢?
网站在阿里云服务器上线教程
主机屋注册域名条件和注意事项都有哪些,如何解析?