centos7下redis的安装和使用

一、centos7上安装redis

安装:尊重作者:http://www.cnblogs.com/web424/p/6796993.html

关闭防火墙:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
配置编译环境:
sudo yum install gcc-c++
下载源码:
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
解压源码:
tar -zxvf redis-3.2.8.tar.gz
进入到解压目录:
cd redis-3.2.8
执行make编译Redis:
make MALLOC=libc
注意:make命令执行完成编译后,会在src目录下生成6个可执行文件,分别是redis-server、redis-cli、redis-benchmark、redis-check-aof、redis-check-rdb、redis-sentinel。
安装Redis:
make install 
配置Redis能随系统启动:
./utils/install_server.sh
显示结果信息如下:
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] 
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] 
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] 
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!

Redis服务查看、开启、关闭:
a.通过ps -ef|grep redis命令查看Redis进程
b.开启Redis服务操作通过/etc/init.d/redis_6379 start命令,也可通过(service redis_6379 start)
c.关闭Redis服务操作通过/etc/init.d/redis_6379 stop命令,也可通过(service redis_6379 stop)

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

二、centos7上使用redis

时间: 2024-07-31 14:37:36

centos7下redis的安装和使用的相关文章

CentOS7下Redis的安装与使用

一.安装过程 1.准备工作(安装gcc依赖) # yum install gcc-c++ 2.下载并解压源码包 # cd /usr/local # wget http://download.redis.io/releases/redis-4.0.10.tar.gz # tar -zxvf redis-4.0.10.tar.gz 3.编译安装 # cd redis-4.0.10 # make MALLOC=libc ## 将/usr/local/redis-4.0.10/src目录下二进制文件安装

centos7下redis和php-redis安装

centos7下redis安装和php-redis扩展安装 //一直yes就可以了 yum install redis //配置 whereis redis.conf vi /etc/redis.conf /搜索 n下一个 bind 127.0.0.1 //远程开放 protected-mode no requirepass 123456 //redis重启 systemctl restart redis redis-cli auth 123456 //临时配置 config get prote

[Redis]windows下redis的安装和启动

官方的下载地址是: http://redis.io/download 在win64一栏中可以看到redis原本是没有windows版本的,windows版本是Microsoft Open Tech团队开的 给出了一个github的链接地址: https://github.com/MSOpenTech/redis 下载: 在https://github.com/MSOpenTech/redis  页面的右下角有  Download Zip的字样,点击之后就可以下载源码的zip包了. 然后就是解压:

Windows下Redis的安装

动手之前,请确认Windows所用用户为administrator 下载地址:https://github.com/MicrosoftArchive/redis/releases . 下载后双击打开进行安装 完事之后 进入安装目录 打开命令行:按住shift点右键->在此处打开命令窗口 redis-server.exe redis.windows.conf  敲回车 如果出现一个大图案 或者啥也没出现 都算正常 只要没报错就行 也可以打开目录中redis.log里查看启动流程 双击目录中的客户端

Centos7下Apache详细安装配置及证书申请SSL配置介绍

首先说到Centos大家都已经非常熟悉了,所以我们也就不多介绍关于Centos具体发展了,我们首先知道在Centos7之前版本命令和ReadHat的命令完全一样的,可Centos从6.0版本升级到Centos7版本之后,命令及功能上有了很大的变化,最明显的差别就是从安装的操作界面及操作命令上已经有很大变化了,更不用说功能上的变化了,比如centos6.x版本的iptalbes到centos7的firewall的变化,当然,变化了很多,我也就不多说了,今天呢,主要给大家介绍一下再Centos7下A

Linux下Redis的安装使用

1.   Linux下Redis的安装使用 官方下载:http://redis.io/download 可以根据需要下载不同版本 下载,解压和安装: $ wgethttp://download.redis.io/releases/redis-2.6.17.tar.gz $ tar xzf redis-2.6.17.tar.gz $ cd redis-2.6.17 $ make 编译后的可执行文件在src目录中,可以使用下面的命令运行Redis: $ src/redis-server 你可以使用内

linux下redis的安装及配置启动

linux下redis的安装及配置启动 标签: redisnosql 2014-10-24 14:04 19732人阅读 评论(0) 收藏 举报  分类: 数据与性能(41)  wget http://download.redis.io/releases/redis-2.8.6.tar.gztar xzf redis-2.8.6.tar.gzcd redis-2.8.6make 有是make会报错 gcc类的错误 则需安装 gcc 如: yum install -y gcc g++ gcc-c+

mac与centos下redis的安装与配置

前言 最近在用redis,下面简单写一下mac和centos下redis的安装与配置方法. 安装 mac下面 安装命令:brew intall redis 运行命令:brew services start redis centos centos在su用户下运行,或者加sudo 安装命令:yum install redis 运行命令:service redis start 配置 mac 在mac下,其配置文件路径是/usr/local/etc/redis.conf centos 在centos下,

CentOS7 下源码安装MySQL 8.0.11

CentOS7 下源码安装MySQL 8.0.11 系统环境:CentOS7, 内核:Linux 3.10.0-862.el7.x86_64 如果有旧版本的MySQL,先卸载,用下面命令来查询出系统有哪些相关的MySQL包. rpm -qa | grep mysql 如果上述命令查询出有相关的MySQL包,就卸载 rpm -e 包名 卸载MariaDB包 yum remove mariadb-libs.x86_64 从MySQL官网下载源码包,并将该文件拷贝到系统中. https://dev.m