xml地图|网站地图|网站标签 [设为首页] [加入收藏]
来自 IT之家 2019-09-28 16:45 的文章
当前位置: 新濠国际登录平台 > IT之家 > 正文

 7.在etc目录下创建redi文件夹并创建配置文件,并

按照下面步骤依次执行
1.检查依赖,安装依赖

CentOS6.4 安装Redis,centos6.4安装redis

按照下面步骤依次执行
1.检查依赖,安装依赖

[[email protected] ~]# whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
[[email protected] ~]# whereis tc
tc: /sbin/tc /usr/lib64/tc /usr/share/tc /usr/share/man/man8/tc.8.gz
[[email protected] ~]# whereis wget
wget: /usr/bin/wget /usr/share/man/man1/wget.1.gz
[[email protected] ~]# yum -y install tcl

2.进入/user/local/src/

[[email protected] ~]# cd /user/local/src/

3.wget下载redis

[[email protected] src]# wget http://download.redis.io/releases/redis-3.0.7.tar.gz

4.解压

[[email protected] src]tar zxvf redis-3.0.7.tar.gz

5.将文件转存到/usr/local/redis

[[email protected] src]mkdir /usr/local/redis
[[email protected] src]mv redis-3.0.7 /usr/local/redis
[[email protected] src]ll /usr/local/redis

6.编译安装

[[email protected] src]cd /usr/local/redis
[[email protected] redis]make && make install

 7.在etc目录下创建redi文件夹并创建配置文件,并修改配置文件

[[email protected] redis]mkdir -p /etc/redis
[[email protected] redis]pwd
[[email protected] redis]cp -fr /usr/local/redis/redis.conf /etc/redis/

8.vim编辑/etc/redis/redis.conf,修改daemonize属性为yes

[[email protected] redis]# vim /usr/local/redis/redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

 9.执行/usr/loal/bin/redis-server /etc/redis/redis.conf来启动redis服务器

[[email protected] redis]# /usr/loal/bin/redis-server /etc/redis/redis.conf
-bash: /usr/loal/bin/redis-server: No such file or directory
[[email protected]-3c46 redis]# /usr/local/bin/redis-server /etc/redis/redis.conf
73449:M 13 May 10:56:00.839 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 73449
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

 10.再打开一个终端,切换至redis的安装目录执行redis-cli

[[email protected] bin]# redis-cli
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> 

 

安装Redis,centos6.4安装redis 按照下面步骤依次执行 1.检查依赖,安装依赖 [[email protected] ~]# whereis gccgcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/...

在企业应用中,对于数据的固化一般采用数据库,但是数据库的吞吐量还是存在一定的问题的,在高并发高吞吐要求时,一般会直接导致数据库的宕机或者死锁,目前对于这个问题的架构是在数据库前边在缓存池,redis就是这么一款产品。
对于redis的介绍,去百度吧,它应该被广泛运用在各个项目中,我们来看如何搭建一个redis集群,这里的集群是个真分布式集群哦。

[root@ecs-3c46 ~]# whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
[root@ecs-3c46 ~]# whereis tc
tc: /sbin/tc /usr/lib64/tc /usr/share/tc /usr/share/man/man8/tc.8.gz
[root@ecs-3c46 ~]# whereis wget
wget: /usr/bin/wget /usr/share/man/man1/wget.1.gz
[root@ecs-3c46 ~]# yum -y install tcl

首先,我们需要下载redis源代码,然后进行编译,以下命令在linux下执行:

2.进入/user/local/src/

wget http://download.redis.io/redis-stable.tar.gz

[root@ecs-3c46 ~]# cd /usr/local/src/

tar xvzf redis-stable.tar.gz

3.wget下载redis

cd redis-stable

[root@ecs-3c46 src]# wget http://download.redis.io/releases/redis-3.0.7.tar.gz

make

4.解压

前面3步应该没有问题,主要的问题是执行make的时候,出现了异常。

[root@ecs-3c46 src]tar zxvf redis-3.0.7.tar.gz

异常一:

5.将文件转存到/usr/local/redis

make[2]: cc: Command not found

[root@ecs-3c46 src]mkdir /usr/local/redis
[root@ecs-3c46 src]mv redis-3.0.7 /usr/local/redis
[root@ecs-3c46 src]ll /usr/local/redis

异常原因:没有安装gcc

新濠国际登录平台,6.编译安装

解决方案:yum install gcc-c++

[root@ecs-3c46 src]cd /usr/local/redis
[root@ecs-3c46 redis]make && make install

异常二:

 7.在etc目录下创建redi文件夹并创建配置文件,并修改配置文件

zmalloc.h:51:31: error: jemalloc/jemalloc.h: No such file or directory

[root@ecs-3c46 redis]mkdir -p /etc/redis
[root@ecs-3c46 redis]pwd
[root@ecs-3c46 redis]cp -fr /usr/local/redis/redis.conf /etc/redis/

异常原因:一些编译依赖或原来编译遗留出现的问题

8.vim编辑/etc/redis/redis.conf,修改daemonize属性为yes

解决方案:make distclean。清理一下,然后再make。

[root@ecs-3c46 redis]# vim /etc/redis/redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

在make成功以后,需要make test。在make test出现异常。

 9.执行/usr/loal/bin/redis-server /etc/redis/redis.conf来启动redis服务器

异常一:

[root@ecs-3c46 redis]# /usr/local/bin/redis-server /etc/redis/redis.conf
-bash: /usr/local/bin/redis-server: No such file or directory
[root@ecs-3c46 redis]# /usr/local/bin/redis-server /etc/redis/redis.conf
73449:M 13 May 10:56:00.839 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 73449
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

couldn't execute "tclsh8.5": no such file or directory

 10.再打开一个终端,切换至redis的安装目录执行redis-cli

异常原因:没有安装tcl

[root@ecs-3c46 bin]# redis-cli
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> 

解决方案:yum install -y tcl。

 

在make成功以后,会在src目录下多出一些可执行文件:redis-server,redis-cli等等。

方便期间用cp命令复制到usr目录下运行。

cp redis-server /usr/local/bin/

cp redis-cli /usr/local/bin/

本文由新濠国际登录平台发布于IT之家,转载请注明出处: 7.在etc目录下创建redi文件夹并创建配置文件,并

关键词: