生产环境可用redis4.0.11安装全过程

生产环境可用redis4.0.11安装全过程
操作系统版本为 centos6.5

先执行initialization.sh优化脚本 详情见 初始化脚本
我们线上用的是redis-4.0.11.tar.gz
根据日志内容进行优化 //后面会提现处理,我们这里可以先执行,不明白的同学,可以继续往后看。

优化1:
[[email protected] conf]# echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
[[email protected] conf]# sysctl -p
优化2:
[[email protected] conf]# echo "net.core.somaxconn = 511" >> /etc/sysctl.conf
[[email protected] conf]# sysctl -p
优化3:
还有一个就是关闭透明大页,我们优化脚本中做了

第一步:执行优化脚本 initialization.sh

第二步:下载redis的安装包
[[email protected] opt]# wget http://download.redis.io/releases/redis-4.0.11.tar.gz

第三步:下载必要的依赖:yum install -y tcl tcl-devel
[[email protected] opt]# yum install -y tcl tcl-devel

第四步:创建相关的目录
[[email protected] opt]# mkdir -p /ivargo/{app,log}
[[email protected] opt]# cd /ivargo/
[[email protected] ivargo]# ll
total 8
drwxr-xr-x 2 root root 4096 Apr 24 15:16 app
drwxr-xr-x 2 root root 4096 Apr 24 15:16 log
[[email protected] ivargo]# cd app/
[[email protected] app]# mkdir redis sentinel
[[email protected] app]# ll
total 8
drwxr-xr-x 2 root root 4096 Apr 24 15:18 redis
drwxr-xr-x 2 root root 4096 Apr 24 15:18 sentinel
[[email protected] app]# cd redis/
[[email protected] redis]# mkdir conf data log
[[email protected] redis]# ll
total 12
drwxr-xr-x 2 root root 4096 Apr 24 15:19 conf
drwxr-xr-x 2 root root 4096 Apr 24 15:19 data
drwxr-xr-x 2 root root 4096 Apr 24 15:19 log

[[email protected] app]# cd sentinel/
[[email protected] sentinel]# ll
total 0
[[email protected] sentinel]# mkdir conf

[[email protected] ivargo]# pwd
/ivargo
[[email protected]s01-10-183 ivargo]# tree
.
├── app
│?? ├── redis
│?? │?? ├── conf
│?? │?? ├── data
│?? │?? └── log
│?? └── sentinel
│??     └── conf
└── log
第五步:安装redis
[[email protected] ivargo]# cd /opt/
[[email protected] opt]# ll
total 1708
-rw-r--r--  1 root root 1739656 Aug  4  2018 redis-4.0.11.tar.gz
drwxr-xr-x. 2 root root    4096 Nov 22  2013 rh
drwxr-xr-x  2 root root    4096 Apr 24  2019 scripts
[[email protected] opt]# tar zxvf redis-4.0.11.tar.gz
[[email protected] opt]# cd redis-4.0.11
[[email protected] redis-4.0.11]# make && make install
...
...
...
第六步:上传配置文件到
[[email protected] conf]# pwd
/ivargo/app/redis/conf
[[email protected] conf]# ll
total 4
-rw-r--r-- 1 root root 3946 Apr 24 15:28 6379.conf
第七步,启动redis
[[email protected] conf]# redis-server /ivargo/app/redis/conf/6379.conf
[[email protected] conf]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      5195/redis-server 0
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1543/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1619/master
tcp        0      0 :::22                       :::*                        LISTEN      1543/sshd
tcp        0      0 ::1:25                      :::*                        LISTEN      1619/master
[[email protected] conf]# ps -ef|grep redis
root       5195      1  0 15:34 ?        00:00:00 redis-server 0.0.0.0:6379
root       5201   1709  0 15:35 pts/0    00:00:00 grep --color=auto redis
第八步检查 redis
[[email protected] log]# vim 6379.log
5194:C 24 Apr 15:34:51.909 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5194:C 24 Apr 15:34:51.909 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=5194, just started
5194:C 24 Apr 15:34:51.909 # Configuration loaded
5195:M 24 Apr 15:34:51.935 * Running mode=standalone, port=6379.
5195:M 24 Apr 15:34:51.935 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/c
ore/somaxconn is set to the lower value of 128.
5195:M 24 Apr 15:34:51.935 # Server initialized
5195:M 24 Apr 15:34:51.935 # WARNING overcommit_memory is set to 0! Background save may fail under low memory c
ondition. To fix this issue add ‘vm.overcommit_memory = 1‘ to /etc/sysctl.conf and then reboot or run the comma
nd ‘sysctl vm.overcommit_memory=1‘ for this to take effect.
5195:M 24 Apr 15:34:51.935 # 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/k
ernel/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.
5195:M 24 Apr 15:34:51.935 * Ready to accept connections

根据日志内容进行优化
优化1:
[[email protected] conf]# echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
[[email protected] conf]# sysctl -p
优化2:
[[email protected] conf]# echo "net.core.somaxconn = 511" >> /etc/sysctl.conf
[[email protected] conf]# sysctl -p
优化3:
还有一个就是关闭透明大页,我们优化脚本中做了
温柔的关闭redis的方法
[[email protected] ~]# redis-server /ivargo/app/redis/conf/6379.conf
[[email protected] ~]# ps -ef|grep redis
root       1718      1  0 18:31 ?        00:00:00 redis-server 0.0.0.0:6379
root       1723   1693  0 18:31 pts/0    00:00:00 grep --color=auto redis
[root[email protected] ~]# redis-cli -a xxx
Warning: Using a password with ‘-a‘ option on the command line interface may not be safe.
127.0.0.1:6379> shutdown    //温柔关闭redis的方法
not connected>
[[email protected] ~]# ps -ef|grep redis
root       1727   1693  0 18:32 pts/0    00:00:00 grep --color=auto redis

[[email protected] conf]# sh /etc/rc.local 

再次启动redis,就没有任何的报警了

到此,我们就安装好了redis,接下来,我们实现redis的sentinel 架构 请期待

原文地址:https://blog.51cto.com/12445535/2385106

时间: 2024-08-06 23:23:18

生产环境可用redis4.0.11安装全过程的相关文章

生产环境可用mysql5.7.23安装全过程

生产环境安装5.7.23全过程 先执行initialization.sh优化脚本 详情见 Linux 在安装mysql前,需要先查看一下是否清空了系统自带了mysql我们这里需要删除系统自带了mysql lib 我们先把mysql放置在/opt下先上传与线上版本一致的 [[email protected] opt]# cat /etc/redhat-release CentOS release 6.5 (Final) [[email protected] opt]# ll total 62932

CENTOS7下安装REDIS4.0.11

拷贝收藏私用,别无他意,原博客地址:https://www.cnblogs.com/zuidongfeng/p/8032505.html 1.安装redis 第一步:下载redis安装包 wget http://download.redis.io/releases/redis-4.0.11.tar.gz 1 2 3 4 5 6 7 8 9 10 11 [[email protected] local]# wget http://download.redis.io/releases/redis-4

安装redis-4.0.11

安装 cd /download wget wget http://download.redis.io/releases/redis-4.0.11.tar.gz tar xvf redis-4.0.11.tar.gz cd redis-4.0.11 make make install mkdir -p /var/redis/6379 # Redis的PID文件位置 mkdir -p /etc/redis # 配置文件 配置文件 cp /download/redis-4.0.11/redis.con

在Ubuntu 14.04上设置生产环境可用的Node.js

在Ubuntu 14.04上设置生产环境可用的Node.js 提供:ZStack社区 前言 Node.js是一个开源的JavaScript运行时环境,开发者可以用它方便的构建服务器端应用和网络应用.Node.js可在Linux.OS X.FreeBSD和Windows上运行,在其上运行的应用使用JavaScript编写.Node.js应用可以在命令行运行,然而本文的目的在于以服务的方式运行Node.js应用,让这些应用可以在系统重启或遇到错误时自动重启,以配合生产环境的需求. 本文将设置一个可用

构建生产环境可用的高可用kubernetes集群

kubernetes集群三步安装 构建生产环境可用的高可用kubernetes集群 | sealos项目地址 特性 [x] 支持任意节点的etcd集群自动构建,且etcd集群使用安全证书,通过static pod方式启动,这样可以通过监控pod来监控etcd集群健康状态 [x] 支持多master节点,允许任意一台master宕机集群功能不受影响 [x] calico使用etcd集群,配置安全证书,网络管控数据无单点故障 [x] 包含dashboard, heapster coreDNS add

[教程] 服务器搭建redis-4.0.11

!!!! 必须先装这个,yum install gcc-c++ wget http://download.redis.io/releases/redis-4.0.11.tar.gz tar xzf redis-4.0.11.tar.gz cd redis-4.0.11 make 原文地址:https://www.cnblogs.com/wangsiming/p/9678202.html

MySQL.8.0.11安装

1.参考:MySQL-mysql 8.0.11安装教程 - Laumians - 博客园.html(http://www.cnblogs.com/laumians-notes/p/9069498.html) 2. 3. 4. 5. 原文地址:https://www.cnblogs.com/dbskill/p/10401744.html

Linux运维一:生产环境CentOS6.6系统的安装

CentOS 6.6 x86_64官方正式版系统(64位)下载地址 系统之家:http://www.xitongzhijia.net/linux/201412/33603.html 百度网盘:http://pan.baidu.com/s/1i5HSsnz 本博客大部分文章如无特别说明都是基于该系统之上的! Linux系统磁盘分区知识简介 1)磁盘在使用前一般要先分区 2)磁盘分区有主分区,扩展分区和逻辑分区之分.一块磁盘最多可以有4个主分区,其中一个主分区的位置可以用一个扩展分区替换,在这个扩展

window平台上的mysql(5.6.24)安装和navicat(10.0.11)安装

准备: 1.window电脑,我的是64位的 2.mysql的压缩包mysql-5.6.24-winx64.zip 3.navicat的压缩包,我的版本是10.0.11 mysql的安装 1.解压,把解压过后的文件夹放到你想放置的任何一个地方,我这里放在F盘,是:F:\mysql-5.6.24-winx64,注意,点击里面的mysql.exe是不能安装的: 2.配置环境变量,首先在系统变量中新建一个“MYSQL_HOME”的变量,值是我们上面的地址“F:\mysql-5.6.24-winx64”