redis的安装总结
1. 下载redis安装包:
> 可以用命令: wget http://download.redis.io/releases/redis-5.0.5.tar.gz, 或者直接从官网下载。
2. 解压:
tar -zxvf redis-5.0.5.tar.gz
3. 安装gcc:
> yum install gcc
4. 进入redis目录并编译安装
> cd redis-5.0.5; make MALLOC=libc; cd src && make install;
> 分别执行三条命令,出现一下表示安装成功
[root@bogon redis-5.0.5]# cd src && make install
CC Makefile.dep
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
1
2
3
4
5
6
7
8
9
10
5. 三种启动方式:
先进入目录 cd src;
1> 用命令直接启动 ./redis-server 出现一下表示成功:
[root@bogon src]# ./redis-server
15281:C 19 Jun 2019 21:59:59.728 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15281:C 19 Jun 2019 21:59:59.728 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=15281, just started
15281:C 19 Jun 2019 21:59:59.728 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
15281:M 19 Jun 2019 21:59:59.730 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 15281
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
15281:M 19 Jun 2019 21:59:59.736 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15281:M 19 Jun 2019 21:59:59.736 # Server initialized
15281:M 19 Jun 2019 21:59:59.736 # WARNING 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.
15281:M 19 Jun 2019 21:59:59.736 # 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.
15281:M 19 Jun 2019 21:59:59.736 * Ready to accept connections
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
但是不能操作,不方便, 按 ctrl + c可以关闭窗口。
2> 以后台进程方式启动redis
a. 修改redis.conf文件: 将 daemonize no 改为 daemonize yes
b. 指定redis的启动文件:(我的redis放在 /usr/java/redis-5.0.5/ ) 执行下面命令:
[root@bogon src]# ./redis-server /usr/java/redis-5.0.5/redis.conf
15855:C 19 Jun 2019 22:41:42.748 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15855:C 19 Jun 2019 22:41:42.749 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=15855, just started
15855:C 19 Jun 2019 22:41:42.749 # Configuration loaded
1
2
3
4
c. 用ps -aux | grep redis查看redis进程
[root@bogon src]# ps -aux | grep redis
root 15430 0.0 0.0 14072 1192 pts/2 S+ 22:06 0:00 redis-cli -h 0.0.0.0 -p 6379 -a password
root 15969 0.0 0.1 144020 2040 ? Ssl 22:51 0:00 ./redis-server 127.0.0.1:6379
root 15974 0.0 0.0 112708 980 pts/1 S+ 22:51 0:00 grep --color=auto redis
1
2
3
4
3> 设置开机启动:
a. 在/etc目录下新建redis目录 :
[root@bogon etc]# mkdir redis
1
b. 将 /usr/java/redis-5.0.5/redis.conf 复制一份到 /etc/redis/, 命名为 6379.conf
[root@bogon etc]# cp /usr/java/redis-5.0.5/redis.conf /etc/redis/6379.conf
1
c. 将redis的启动脚本复制一份放到/etc/init.d目录下, 命名为redisd
[root@bogon etc]# cp /usr/java/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd
1
d. 设置开机启动
[root@bogon etc]# cd /etc/init.d/
[root@bogon init.d]# chkconfig redisd on
//
如果出现
service redisd does not support chkconfig,
是redisd不支持chkconfig,
使用vim编辑redisd文件,在第一行加入如下两行注释,保存退出
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
注释的意思是,redis服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是90,关闭的优先级是10。
1
2
3
4
5
6
7
8
9
10
11
12
e. 启动: service redisd start / service redisd stop
[root@bogon init.d]# service redisd start
/var/run/redis_6379.pid exists, process is already running or crashed
出现这个错误的时候,重启系统就好了,下面是开关服务的提示:
[root@bogon ~]# service redisd stop
Stopping ...
Waiting for Redis to shutdown ...
Redis stopped
[root@bogon ~]# service redisd start
Starting Redis server...
1829:C 19 Jun 2019 23:39:12.204 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1829:C 19 Jun 2019 23:39:12.204 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1829, just started
1829:C 19 Jun 2019 23:39:12.204 # Configuration loaded
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---------------------
redis的安装总结的更多相关文章
- redis的安装配置
主要讲下redis的安装配置,以及以服务的方式启动redis 1.下载最新版本的redis-3.0.7 到http://redis.io/download中下载最新版的redis-3.0.7 下载后 ...
- Linux下Redis的安装和部署
一.Redis介绍 Redis是当前比较热门的NOSQL系统之一,它是一个key-value存储系统.和Memcache类似,但很大程度补偿了Memcache的不足,它支持存储的value类型相对更多 ...
- 基于C#的MongoDB数据库开发应用(4)--Redis的安装及使用
在前面介绍了三篇关于MongoDB数据库的开发使用文章,严格来讲这个不能归类于MongoDB数据库开发,不过Redis又有着和MongoDB数据库非常密切的关系,它们两者很接近,Redis主要是内存中 ...
- Linux下Redis的安装与配置
redis是当前比较热门的NOSQL系统之一,它是一个key-value存储系统.和Memcached类似,但很大程度补偿了 memcached的不足,它支持存储的value类型相对更多,包括stri ...
- [nosql之redis]yum安装redis
1.首先对于这种nosql来说目前我用到的功能很少,所以感觉没有必要去优化他跟不需要去编译安装.今天来介绍下一个yum安装redis 步骤1:安装扩展yum库 [root@localhost ~]# ...
- Linux下redis的安装
第一部分:安装redis 希望将redis安装到此目录 /usr/local/redis 希望将安装包下载到此目录 /usr/local/src 那么安装过程指令如下: $ mkdir /usr/lo ...
- redis的安装和启动
Windows下Redis的安装及PHP扩展使用 时间 2014-10-28 17:47:09 CSDN博客 原文 http://blog.csdn.net/wyqwclsn/article/de ...
- linux下redis的安装与部署及基础命令
<1>下载安装文件:redis-3.2.5.tar.gz 放在opt目录下 <2> tar -zxvf redis-3.2.5.tar.gz,备份redis.conf到自己的目 ...
- redis/php redis扩展 安装
作者:silenceper 日期:2013-10-03 原文地址: http://silenceper.com/archives/952.html 我是在CentOS 6.3 中进行的. 使用到的软件 ...
- [Linux]Linux下redis的安装及配置.
在上一篇[Linux] linux下安装配置 zookeeper/redis/solr/tomcat/IK分词器 详细实例. 我们已经将redis所需tar包拷贝到了linux下的root 根目录下, ...
随机推荐
- 《编程珠玑,字字珠玑》读书笔记完结篇——AVL树
写在最前面的 手贱翻开了<珠玑>的最后几章,所以这一篇更多是关于13.14.15章的内容.这篇文章的主要内容是“AVL树”,即平衡树,比红黑树低一个等次.捣乱真惹不起红黑树,情况很复杂:而 ...
- 查询及删除重复记录的SQL语句
1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where peopleId in (select peopleId from ...
- window 下拉取github项目失败 (Permission denied (publickey))
原因是github 帐号ssh 失效或者没有配置 1.找到gitcmd 并进入 2.在gitcmd 下切换到 安装git路劲\Git\usr\bin 3.提示在C:\Users\Administrat ...
- Java SE 开篇
一. Java SE 开篇 1. Java 基本数据类型及其对应的包装类 基本数据类型 对应的包装类 * byte Byte * boolean Boolean * char Character ...
- c语言中的rand()函数用法
rand() rand()函数作用:用来产生随机数,但是,rand()的内部实现是用线性同余法实现的,是伪随机数,由于周期较长,因此在一定范围内可以看成是随机的. rand()函数返回:返回一个范围在 ...
- Qt对象模型之一:信号和槽
一.信号和槽机制概述 信号槽是 Qt 框架引以为豪的机制之一.所谓信号槽,实际就是观察者模式.当某个事件发生之后,比如,按钮检测到自己被点击了一下,它就会发出一个信号(signal).这种发出是没有目 ...
- 01背包 Codeforces Round #267 (Div. 2) C. George and Job
题目传送门 /* 题意:选择k个m长的区间,使得总和最大 01背包:dp[i][j] 表示在i的位置选或不选[i-m+1, i]这个区间,当它是第j个区间. 01背包思想,状态转移方程:dp[i][j ...
- android 系统的时间间隔和睡眠用哪个?
原文 : https://developer.android.com/reference/android/os/SystemClock.html SystemClock.elapsedRealtime ...
- java awt 乱码问题
问题:项目环境是utf-8,awt的元件比如label一直乱码 解决: (eclipse) 1.在你的具有main函数的类也即你应用运行的主类上点击右键,选择Run As中的Run Configura ...
- 421 Maximum XOR of Two Numbers in an Array 数组中两个数的最大异或值
给定一个非空数组,数组中元素为 a0, a1, a2, … , an-1,其中 0 ≤ ai < 231 .找到 ai 和aj 最大的异或 (XOR) 运算结果,其中0 ≤ i, j < ...