Centos-7.4_安装_Redis_4.0.8
一、安装redis
第一步:下载redis安装包
[root@Redis ~]# mkdir /usr/local/redis/ --创建目录
[root@Redis redis]# cd /usr/local/redis/ --进入当前目录
[root@Redis ~]# wget http://download.redis.io/releases/redis-4.0.8.tar.gz --下载软件包
--2018-12-30 12:20:30-- http://download.redis.io/releases/redis-4.0.8.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 109.74.203.151
正在连接 download.redis.io (download.redis.io)|109.74.203.151|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1729973 (1.6M) [application/x-gzip]
正在保存至: “redis-4.0.8.tar.gz”
100%[===================================================================================================================================================>] 1,729,973 841KB/s 用时 2.0s
2018-12-30 12:20:32 (841 KB/s) - 已保存 “redis-4.0.8.tar.gz” [1729973/1729973])
第二步:解压压缩包
[root@Redis redis]# tar -zxvf redis-4.0.8.tar.gz
第三步:yum安装gcc依赖
[root@Redis redis]# yum -y install gcc-*
第四步:跳转到redis解压目录下
[root@Redis redis]# cd redis-4.0.8/
第五步:编译安装
[root@Redis redis]# make MALLOC=libc
将/usr/local/redis-4.0.8/src目录下的文件加到/usr/local/bin目录
cd src && make install
[root@Redis redis-4.0.8]# 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
二、启动redis的三种方式
先切换到redis src目录下
[root@Redis redis-4.0.8]# cd src/
1、直接启动redis
[root@Redis src]# ./redis-server
35611:C 30 Dec 12:16:11.035 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
35611:C 30 Dec 12:16:11.036 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=35611, just started
35611:C 30 Dec 12:16:11.036 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
35611:M 30 Dec 12:16:11.036 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 35611
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
35611:M 30 Dec 12:16:11.037 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
35611:M 30 Dec 12:16:11.037 # Server initialized
35611:M 30 Dec 12:16:11.037 # 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.
35611:M 30 Dec 12:16:11.037 # 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.
35611:M 30 Dec 12:16:11.037 * Ready to accept connections
如上图:redis启动成功,但是这种启动方式需要一直打开窗口,不能进行其他操作,不太方便。
按 ctrl + c可以关闭窗口。
2、以后台进程方式启动redis
第一步:修改redis.conf文件
[root@Redis src]# vim /usr/local/redis/redis-4.0.8/redis.conf
将
daemonize no
修改为
daemonize yes
第二步:指定redis.conf文件启动
[root@Redis src]# ./redis-server /usr/local/redis/redis-4.0.8/redis.conf
45390:C 30 Dec 12:42:32.886 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
45390:C 30 Dec 12:42:32.886 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=45390, just started
45390:C 30 Dec 12:42:32.886 # Configuration loaded
第三步:关闭redis进程
首先使用ps -aux | grep redis查看redis进程
[root@Redis src]# ps -aux | grep redis
root 45391 0.0 0.0 141816 2004 ? Rsl 12:42 0:00 ./redis-server 127.0.0.1:6379
使用kill命令杀死进程
[root@Redis src]# kill -9 45391
3、设置redis开机自启动
1、在/etc目录下新建redis目录
mkdir redis
[root@Redis src]# mkdir /etc/redis
2、将/usr/local/redis/redis-4.0.8/redis.conf 文件复制一份到/etc/redis目录下,并命名为6379.conf
[root@Redis src]# cp /usr/local/redis/redis-4.0.8/redis.conf /etc/redis/6379.com
3、将redis的启动脚本复制一份放到/etc/init.d目录下
[root@Redis src]# cp /usr/local/redis/redis-4.0.8/utils/redis_init_script /etc/init.d/redisd
4、设置redis开机自启动
先切换到/etc/init.d目录下
然后执行自启命令
[root@Redis init.d]# chkconfig redisd on
服务 redisd 不支持 chkconfig
看结果是redisd不支持chkconfig
解决方法:
使用vim编辑redisd文件,在第一行加入如下两行注释,保存退出
注释的意思是,redis服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是90,关闭的优先级是10。
再次执行开机自启命令,成功
[root@Redis init.d]# chkconfig redisd on
现在可以直接已服务的形式启动和关闭redis了
启动:
service redisd start
如果出现如下问题:
[root@Redis ~]# service redisd start
Please use start or stop as first argument
可用安装文件启动 redis-server /etc/redis/6379.conf
[root@Redis ~]# redis-server /etc/redis/6379.conf
9562:C 30 Dec 13:44:57.160 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9562:C 30 Dec 13:44:57.160 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=9562, just started
9562:C 30 Dec 13:44:57.160 # Configuration loaded
参考文件:
redis报错可参考资料:http://blog.csdn.net/luozhonghua2014/article/details/54649295
redis安装可参考资料:http://blog.csdn.net/zc474235918/article/details/50974483
redis安装可参考资料:http://blog.csdn.net/gxw19874/article/details/51992125
Centos-7.4_安装_Redis_4.0.8的更多相关文章
- CentOS Stream 8 安装 Zabbix6.0 -- LNMP环境(nginx-1.20,mariadb-10.6,php-7.4)
镜像下载.域名解析.时间同步请点击阿里云开源镜像站 zabbix6.0 LTS版本出来了,前段时间刚安装了5.4,今天打算在虚拟机上安装6.0测试,安装6.0的要求php版本不低于7.2,mariad ...
- centos 7下安装mysql-8.0
本篇文章主要介绍在centos7 环境下安装mysql8.0并设置为开机自启. 安装步骤 1.配置yum源 首先在 https://dev.mysql.com/downloads/repo/yum/ ...
- centos 6.5 安装 buildbot-slave 0.8.9
公司服务器多数都用的centos,这个是大环境,改不了,只好研究怎么安装buildbot-slave. buildbot-master倒是没有问题,可控,自己弄了一个ubuntu14来玩. cento ...
- CentOS 6.4 安装 Fcitx4.0
一.首先安装中文支持: su root yum install "@Chinese Support" exit yum remove ibus 注销再登陆 二.安装fcitx 下载 ...
- CentOS 6下安装nodejs 0.9.0
确保安装了python,大部分安装失败都是由于python版本过低导致.安装之前,升级python版本,升级步骤 http://www.tomtalk.net/wiki/Python. [root@S ...
- CentOS 6下安装nodejs 0.9.0(转)
确保安装了python,大部分安装失败都是由于python版本过低导致.安装之前,升级python版本,升级步骤 http://www.tomtalk.net/wiki/Python. [root@S ...
- CentOS通过yum安装php7.0
一.删除旧版本 如果已经安装过php就先删除之前的版本.检查方法如下: yum list installed | grep php 然后将安装的包进行删除 比如 yum remove php.x86_ ...
- Red Hat Enterprise Linux / CentOS 7 yum安装zabbix4.0
添加Zabbix存储库安装存储库配置包. 该软件包包含yum(软件包管理器)配置文件. rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_6 ...
- Centos下Yum安装PHP7.0
默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案: 1.检查当前安装的PHP包 yum list installed | grep php 如果有安装的PHP包,先删除他们 ...
随机推荐
- k64 datasheet学习笔记39---Programmable Delay Block (PDB)
0.前言 TODO 1.特性 TODO 4. 功能描述 4.1 PDB pre-trigger and trigger outputs PDB包含一个计数器,它的输出可以跟几个不同的数字值比较.如果P ...
- Lua中的环境概念
[前言] Lua将其所有的全局变量保存在一个常规的table中,这个table称为“环境”.这种组织结构的优点在于,其一,不需要再为全局变量创造一种新的数据结构,因此简化了Lua的内部实现:另一个优点 ...
- C“控制”Lua
[前言] 写过Windows程序的人都知道,对于应用程序,如果需要在本地保存一些配置信息,我们经常将这些配置信息写在注册表或者本地的配置文件中,很多应用都是将一些配置信息写在配置文件中,比如以ini结 ...
- windows下实现定时重启Apache与MySQL方法
采用at命令添加计划任务.有关使用语法可以到window->“开始”->运行“cmd”->执行命令“at /”,这样界面中就会显示at命令的语法.下面我们讲解下如何让服务器定时启动a ...
- 【原创】大叔经验分享(2)为什么hive在大表上加条件后执行limit很慢
问题重现 select id from big_table where name = 'sdlkfjalksdjfla' limit 100; 首先看执行计划: hive> explain se ...
- 关于git 远程仓库密码一直输错的问题
解决方法, git 换地方使用后需要重新配置秘钥,一个钥匙开一个地方的门: 如果还不行, 在控制面板-用户账户-凭据管理-加添凭证,输入正确的账号密码:因为Windows的凭据管理器里面可能保存了你刚 ...
- 二维前缀和好题hdu6514
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; ]; )* ...
- 在Pycharm中自动添加时间日期作者等信息
1.按照下面路径以此打开File→→Settings→→Editor→→File and code Templates 右侧找到Python Script,如下图 2.设置相关代码如下 ##!/usr ...
- pandas合并数据集-【老鱼学pandas】
有两个数据集,我们想把他们的结果根据相同的列名或索引号之类的进行合并,有点类似SQL中的从两个表中选择出不同的记录并进行合并返回. 合并 首先准备数据: import pandas as pd imp ...
- 1002-谈谈ELK日志分析平台的性能优化理念
在生产环境中,我们为了更好的服务于业务,通常会通过优化的手段来实现服务对外的性能最大化,节省系统性能开支:关注我的朋友们都知道,前段时间一直在搞ELK,同时也记录在了个人的博客篇章中,从部署到各个服务 ...