大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
小编给大家分享一下centos7.8如何安装redis5.0.10,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
成都创新互联不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的网站设计制作、做网站质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式全网整合营销推广需求,让再小的高端网站设计也能产生价值!
centos7.8服务器一台
# hostnamectl set-hostname redishost
# cd /opt # wget https://download.redis.io/releases/redis-5.0.10.tar.gz
# cd /opt # tar -zxf redis-5.0.10.tar.gz
# cd /opt # cd redis-5.0.10 ## 安装gcc编译器 # yum install gcc # make MALLOC=libc # # make install cd src && make install make[1]: Entering directory `/opt/redis-5.0.10/src' Hint: It's a good idea to run 'make test' ;) INSTALL install INSTALL install INSTALL install INSTALL install INSTALL install make[1]: Leaving directory `/opt/redis-5.0.10/src
## 修改sysctl.conf # ( cat <> /etc/sysctl.conf
以上操作是解决redis-server默认启动提示的前两个警告的持久方案,附redis-server默认启动的两个警告信息如下:
The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
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.
## 修改/etc/default/grub ## 在指定行加 transparent_hugepage=never # vi /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never" GRUB_DISABLE_RECOVERY="true" ## 重新生成grub配置文件 # grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-1127.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1127.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-385c7efe9475460c95c436866e593af3 Found initrd image: /boot/initramfs-0-rescue-385c7efe9475460c95c436866e593af3.img done
以上操作是解决redis-server默认启动提示的第三个警告的持久方案,附redis-server默认启动的第三个警告信息如下:
you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting after a reboot. Redis must be restarted after THP is disabled.
根据提示将'echo never > /sys/kernel/mm/transparent_hugepage/enabled' 写入/etc/rc.local 其实并没有用,换成修改grub启动文件可以生效。
# cd /opt/redis-5.0.10 # mkdir /etc/redis # cp redis.conf /etc/redis/redis.conf
在/etc/redis/redis.conf中修改以下3项
以后台进程方式启动
修改daemonize no 为daemonize yes
设置redis远程连接
注释掉bind 127.0.0.1
设置redis连接密码
在requirepass foobard改为requirepass redis1234
/usr/lib/systemd/system/redis.service
[Unit] Description=Redis 6379 After=syslog.target network.target [Service] Type=forking PrivateTmp=yes Restart=always ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf User=root Group=root LimitCORE=infinity LimitNOFILE=100000 LimitNPROC=100000 [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl enable redis
systemctl enable redis systemctl start redis systemctl restart redis
以上是“centos7.8如何安装redis5.0.10”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!