【环境准备】centos 6.5 安装redis 源码安装
2017-08-02 21:51
260 查看
CentOS6.5下redis安装部署配置
1、Redis的安装目录创建进入
[root@localhost /]# mkdir redisServer && cd redisServer
1.2、redis下载
[root@localhost redisServer]# wget http://download.redis.io/releases/redis-3.0.5.tar.gz
1.3、解压
[root@localhost redisServer]# tar xf redis-3.0.5.tar.gz
这样就在当前目录下新建了一个包含发行版源代码的目录,必须cd进入这个目录以继续服务器的编译。
1.4、编译及安装
进入redis解压目录,执行如下命令编译Redis:
[root@localhost
redis-3.0.5]# cd redis-3.0.5
[root@localhost redis-3.0.5]# make && make install
1.5、配置 [也可以直接启动]
接着,复制redis.conf到/etc/下,修改配置文件,来配置Redis服务器。
1 [root@localhost redis-3.0.5]# cp redis.conf /etc/
1.6、参数参看
1234567891011121314 [root@localhost redis-3.0.5]# redis-server --help
Usage: ./redis-server [/path/to/redis.conf] [options]
./redis-server - (read config from stdin)
./redis-server -v or --version
./redis-server -h or --help
./redis-server --test-memory <megabytes>
Examples:
./redis-server (run the server with default conf)
./redis-server /etc/redis/6379.conf
./redis-server --port 7777
./redis-server --port 7777 --slaveof 127.0.0.1 8888
./redis-server /etc/myredis.conf --loglevel verbose
Sentinel mode:
./redis-server /etc/sentinel.conf --sentinel
1.7、版本参看
[root@localhost redis-3.0.5]# redis-server -v
Redis server v=3.0.5 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=ee8d4e51452e5879
1.8、启动Redis服务器
[root@localhost redis-3.0.5]# redis-server /etc/redis.conf
注:此命令仅有一个启动参数,指定/path/to/redis.conf目录下的配置文件,不加参数执行默认配置。
[root@localhost ~]# redis-cli ping
PONG
测试启动 redis-cli ping 返回PONG,启动成功。
[root@localhost ~]# netstat -tulnp | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 11731/redis-server
tcp 0 0 :::6379 :::* LISTEN 11731/redis-server
1.9、停止Redis
关闭服务
[root@localhost ~]# redis-cli shutdown
[root@localhost ~]# netstat -tulnp | grep 6379
[root@localhost ~]# redis-cli ping
Could not connect to Redis at 127.0.0.1:6379: Connection refused
注:可指定端口:redis-cli -p <port> shutdown
1.10、连接Redis
两种链接redis的方法:
方法一、
[root@localhost ~]# redis-cli #也可以指定ip,端口号启动redis(redis-cli -h 192.168.1.2 -p 6379)
127.0.0.1:6379>
127.0.0.1:6379> quit
方法二、
[root@localhost ~]# telnet 192.168.1.2 6379
Trying 192.168.1.2...
Connected to 192.168.1.2.
Escape character is '^]'.
quit
+OK
Connection closed by foreign host
1、Redis的安装目录创建进入
[root@localhost /]# mkdir redisServer && cd redisServer
1.2、redis下载
[root@localhost redisServer]# wget http://download.redis.io/releases/redis-3.0.5.tar.gz
1.3、解压
[root@localhost redisServer]# tar xf redis-3.0.5.tar.gz
这样就在当前目录下新建了一个包含发行版源代码的目录,必须cd进入这个目录以继续服务器的编译。
1.4、编译及安装
进入redis解压目录,执行如下命令编译Redis:
[root@localhost
redis-3.0.5]# cd redis-3.0.5
[root@localhost redis-3.0.5]# make && make install
1.5、配置 [也可以直接启动]
接着,复制redis.conf到/etc/下,修改配置文件,来配置Redis服务器。
1 [root@localhost redis-3.0.5]# cp redis.conf /etc/
1.6、参数参看
1234567891011121314 [root@localhost redis-3.0.5]# redis-server --help
Usage: ./redis-server [/path/to/redis.conf] [options]
./redis-server - (read config from stdin)
./redis-server -v or --version
./redis-server -h or --help
./redis-server --test-memory <megabytes>
Examples:
./redis-server (run the server with default conf)
./redis-server /etc/redis/6379.conf
./redis-server --port 7777
./redis-server --port 7777 --slaveof 127.0.0.1 8888
./redis-server /etc/myredis.conf --loglevel verbose
Sentinel mode:
./redis-server /etc/sentinel.conf --sentinel
1.7、版本参看
[root@localhost redis-3.0.5]# redis-server -v
Redis server v=3.0.5 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=ee8d4e51452e5879
1.8、启动Redis服务器
[root@localhost redis-3.0.5]# redis-server /etc/redis.conf
注:此命令仅有一个启动参数,指定/path/to/redis.conf目录下的配置文件,不加参数执行默认配置。
[root@localhost ~]# redis-cli ping
PONG
测试启动 redis-cli ping 返回PONG,启动成功。
[root@localhost ~]# netstat -tulnp | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 11731/redis-server
tcp 0 0 :::6379 :::* LISTEN 11731/redis-server
1.9、停止Redis
关闭服务
[root@localhost ~]# redis-cli shutdown
[root@localhost ~]# netstat -tulnp | grep 6379
[root@localhost ~]# redis-cli ping
Could not connect to Redis at 127.0.0.1:6379: Connection refused
注:可指定端口:redis-cli -p <port> shutdown
1.10、连接Redis
两种链接redis的方法:
方法一、
[root@localhost ~]# redis-cli #也可以指定ip,端口号启动redis(redis-cli -h 192.168.1.2 -p 6379)
127.0.0.1:6379>
127.0.0.1:6379> quit
方法二、
[root@localhost ~]# telnet 192.168.1.2 6379
Trying 192.168.1.2...
Connected to 192.168.1.2.
Escape character is '^]'.
quit
+OK
Connection closed by foreign host
相关文章推荐
- CentOS6.5安装LAMP环境的前期准备
- centos6.5环境自动化运维之puppet实现nginx反向代理功能及puppet安装配置详解
- CentOS6.5 搭建基础PHP环境(yum安装)
- centos 6.5 快速安装PHP环境
- 在centos6.5 64bit环境下安装最新版本的git
- centos-6.5安装部署LNMP环境
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- centos6.5安装gcc6.1等c++环境
- 2、单机运行环境搭建之 --CentOS-6.5安装配置Tomcat7
- 搭建JEESZ分布式架构2--CentOs下安装Tomcat7(环境准备)
- CentOS 6.5 LNMP环境搭建 编译安装Mysql
- CentOS 6.5 生产环境编译安装LNMP
- CentOS6.5之Java开发环境—JDK1.8的安装配置—逆袭必备
- CentOS 6.5 系统安装及LAMP环境安装(yum方式)配置详解(二)
- CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
- 2、单机运行环境搭建之 --CentOS-6.5安装配置Tomcat8
- centos6.5环境下tensoflow0.8.0的安装测试
- 搭建JEESZ分布式架构3--CentOs下安装MySQL(环境准备)
- CentOS7.1 安装Liberty之环境准备(1)