CentOS 编译安装 Redis (实测 笔记 Centos 7.3 + redis 3.2.8)
环境:
系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡)
系统版本:CentOS-7.0-1406-x86_64-DVD.iso
安装步骤:
1.准备
1.1 显示系统版本
[root@centos ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@centos ~]# uname -r
3.10.0-514.6.1.el7.x86_64
1.2 安装基本软件包
[root@centos ~]# yum install vim wget lsof gcc gcc-c++ -y
1.3 显示IP地址
[root@centos ~]# ip addr|grep inet
inet 127.0.0.1/8 scope host lo
inet 192.168.1.10/24 brd 192.168.1.255 scope global ens160
2.安装redis
2.1 安装依赖
[root@centos ~]# yum install tcl -y
[root@centos ~]# cd /usr/local/src
[root@centos ~]# wget http://download.redis.io/releases/redis-4.0.9.tar.gz
[root@centos ~]# tar -zxvf redis-4.0.9.tar.gz && cd redis-4.0.9
[root@centos ~]# make && make PREFIX=/opt/redis install
[root@centos ~]# groupadd redis
[root@centos ~]# useradd -g redis redis -s /sbin/nologin
[root@centos ~]# mkdir -p /opt/redis/logs
[root@centos ~]# cp redis.conf /opt/redis
[root@centos ~]# ll /opt/redis
[root@centos ~]# chown -R redis:redis /opt/redis
[root@centos ~]# vim /opt/redis/redis.conf
找到相关的行,修改
#bind 127.0.0.1
protected-mode no
requirepass redispwd
daemonize no
supervised no
pidfile /opt/redis/redis_6379.pid
logfile /opt/redis/redis_6379.log
dbfilename dump.rdb
dir /opt/redis
保存,退出
[root@centos ~]# vim /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis Server
After=network.target
[Service]
Type=simple
PIDFile=/opt/redis/redis_6379.pid
ExecStart=/opt/redis/bin/redis-server /opt/redis/redis.conf
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
User=redis
[Install]
WantedBy=multi-user.target
保存,退出
[root@centos ~]# systemctl enable redis
[root@centos ~]# systemctl start redis
[root@centos ~]# systemctl daemon-reload
[root@centos ~]# systemctl status firewalld
配置打开端口
[root@centos ~]# iptables -L --line-numbers|grep ACCEPT
[root@centos ~]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
**************************************************************************************************
指定IP可以访问
[root@centos ~]# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.25" port protocol="tcp" port="6379" accept"
移除指定IP可以访问
[root@centos ~]# firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.25" port protocol="tcp" port="6379" accept"
**************************************************************************************************
[root@centos ~]# firewall-cmd --reload && iptables -L --line-numbers|grep ACCEPT
安装完成后,打开客户端
[root@centos ~]# /opt/redis/bin/redis-cli -h 127.0.0.1 -p 6379
输入以下命令,测试写入及读取
127.0.0.1:6379 > auth redispwd
127.0.0.1:6379 > set name abc123
127.0.0.1:6379 > get name
退出
quit
手动持久化(保存到硬盘)
[root@centos ~]# /opt/redis/bin/redis-cli save
redis.conf 的配置信息
1、daemonize 如果需要在后台运行,把该项改为yes
2、pidfile 配置多个pid的地址 默认在/var/run/redis.pid
3、bind 绑定ip,设置后只接受来自该ip的请求
4、port 监听端口,默认是6379
5、loglevel 分为4个等级:debug verbose notice warning
6、logfile 用于配置log文件地址
7、databases 设置数据库个数,默认使用的数据库为0
8、save 设置redis进行数据库镜像的频率。
9、rdbcompression 在进行镜像备份时,是否进行压缩
10、dbfilename 镜像备份文件的文件名
11、Dir 数据库镜像备份的文件放置路径
12、Slaveof 设置数据库为其他数据库的从数据库
13、Masterauth 主数据库连接需要的密码验证
14、Requriepass 设置 登陆时需要使用密码
15、Maxclients 限制同时使用的客户数量
16、Maxmemory 设置redis能够使用的最大内存
17、Appendonly 开启append only模式
18、Appendfsync 设置对appendonly.aof文件同步的频率(对数据进行备份的第二种方式)
19、vm-enabled 是否开启虚拟内存支持 (vm开头的参数都是配置虚拟内存的)
20、vm-swap-file 设置虚拟内存的交换文件路径
21、vm-max-memory 设置redis使用的最大物理内存大小
22、vm-page-size 设置虚拟内存的页大小
23、vm-pages 设置交换文件的总的page数量
24、vm-max-threads 设置VM IO同时使用的线程数量
25、Glueoutputbuf 把小的输出缓存存放在一起
26、hash-max-zipmap-entries 设置hash的临界值
27、Activerehashing 重新hash
redis【持久化】配置:
http://blog.csdn.net/vtopqx/article/details/46833513
1、rdb
save 900 1
save 300 10
save 60 10000
2、aof
appendfsync always
appendfsync everysec
appendfsync no
redis【主从】配置:
http://blog.csdn.net/yilukuangpao/article/details/52004257
vi etc/redis.conf
#绑定IP地址
bind 192.168.88.128
#若当前服务为slave,在此处设置主服务的ip及端口
slaveof 10.10.10.200 6379
#若当前服务为slave,设置主服务的认证密码
masterauth 01130229
127.0.0.1:6379> slaveof 10.10.10.200 6379
显示ok,也就OK了
redis【集群】配置:
http://blog.csdn.net/jhq0113/article/details/44134833
http://blog.csdn.net/zj0116/article/details/44673017
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis_6379.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
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 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
CentOS 编译安装 Redis (实测 笔记 Centos 7.3 + redis 3.2.8)的更多相关文章
- CentOS 编译安装 Nodejs (实测 笔记 Centos 7.3 + node 6.9.5)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Mongodb (实测 笔记 Centos 7.0 + Mongodb 2.6.6)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Mariadb (实测 笔记 Centos 7.0 + Mariadb 10.0.15)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- CentOS7 编译安装 Nodejs (实测 笔记 Centos 7.0 + node 0.10.33)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- Centos编译安装PHP 5.5笔记
本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...
- CentOS编译安装NodeJS+Express
NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...
- nginx php-fpm安装配置 CentOS编译安装php7.2
CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...
- Redis学习笔记(2)——Redis的下载安装部署
一.下载Redis Redis的官网下载页上有各种各样的版本,如图 但是官网下载的Redis项目不正式支持Windows.如果需要再windows系统上部署,要去GitHub上下载.我下载的是Redi ...
随机推荐
- VS2013创建ASP.NET应用程序描述
你的 ASP.NET 应用程序 恭喜! 你已创建了一个项目 此应用程序包含: 显示“主页”.“关于”和“联系方式”之间的基本导航的示例页 使用 Bootstrap 进行主题定位 身份验证,如果选择此项 ...
- Pycharm问题:module 'pip' has no attribute 'main'
更新pip之后(pip 10 版本之后),Pycharm安装package出现报错:module 'pip' has no attribute 'main' 解决办法如下: 找到Pycharm安装目录 ...
- CV code references
转:http://www.sigvc.org/bbs/thread-72-1-1.html 一.特征提取Feature Extraction: SIFT [1] [Demo program][SI ...
- 留恋 nyoj 854
留恋 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 大家都知道,高中的时候,座位基本都是固定的,但是对于视力不好却又坐在后面的人是很不公平的. 念情的高中班主任安哥 ...
- RCNN论文学习
[Rich feature hierarchies for accurate object detection and semantic segmentation] Abstract 论文的方 ...
- 关于Java中构造方法的问题以及回答
构造方法 概念: 又叫 构造器,区分于传统的方法,是一个在创建对象时被系统自动调用的特殊方法 作用: 一:为对象进行初始化(成员变量)的工作 二:为对象在堆内存中开辟独立的内存空间 定义格式: 访问修 ...
- sortable.js 拖拽排序及配置项说明
// 拖动排序 $(function() { /*排序*/ //排序 // Simple list ]; new Sortable(list, { group: "name", a ...
- ****微信小程序架构解析
| 导语 微信小程序的公测掀起了学习小程序开发的浪潮,天生跨平台,即用即走.媲美原生体验.完善的文档.高效的开发框架,小程序给开发者带来了很多惊喜.通过这篇文章和大家一起分析小程序的架构,分享开发 ...
- 关于JS前台计算四舍五入的问题
//除法函数 //说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显.这个函数返回较为精确的除法结果. //调用:accDiv(arg1,arg2) //返回值:arg1除 ...
- RESTful-1概述
一种软件架构风格.设计风格,而不是标准,只是提供了一组设计原则和约束条件.它主要用于客户端和服务器交互类的软件.基于这个风格设计的软件可以更简洁,更有层次,更易于实现缓存等机制. 概述 编辑 REST ...