随笔 - 139  文章 - 1  评论 - 0  阅读 - 47214

redis配置部署

版本:redis6.0.9

redis部署步骤如下: 

[root@localhost software]# pwd

/data/software 

wget http://download.redis.io/releases/redis-6.0.9.tar.gz 

[root@localhost software]# ll

total 2240

-rw-r--r--. 1 root root   25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm

-rw-r--r--. 1 root root 2261418 Oct 27 03:14 redis-6.0.9.tar.gz

把下载完的redis安装包解压:

tar -zxvf redis-6.0.9.tar.gz 

[root@localhost software]# pwd

/data/software 

[root@localhost software]# ll

total 2244

-rw-r--r--. 1 root root   25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm

drwxrwxr-x. 7 root root    4096 Oct 27 03:12 redis-6.0.9

-rw-r--r--. 1 root root 2261418 Oct 27 03:14 redis-6.0.9.tar.gz 

进入解压后的redis目录进行编译make

[root@localhost software]# cd redis-6.0.9/

[root@localhost redis-6.0.9]# pwd

/data/software/redis-6.0.9 

注意:在执行make命令时报错: 

make[2]: Leaving directory `/data/software/redis-6.0.9/deps'

make[1]: [persist-settings] Error 2 (ignored)

    CC adlist.o

/bin/sh: cc: command not found

make[1]: *** [adlist.o] Error 127

make[1]: Leaving directory `/data/software/redis-6.0.9/src'

make: *** [all] Error 2 

解决方法:

yum  install  gcc -y 

之后执行make命令继续报如下错: 

[root@localhost redis-6.0.9]# make

cd src && make all

make[1]: Entering directory `/data/software/redis-6.0.9/src'

    CC Makefile.dep

make[1]: Leaving directory `/data/software/redis-6.0.9/src'

make[1]: Entering directory `/data/software/redis-6.0.9/src'

    CC adlist.o

In file included from adlist.c:34:0:

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

 #include <jemalloc/jemalloc.h>

                               ^

compilation terminated.

make[1]: *** [adlist.o] Error 1

make[1]: Leaving directory `/data/software/redis-6.0.9/src'

make: *** [all] Error 2

  1. 解决方法:升级GCC版本,CentOS7默认安装的是4.8.5,而redis6.0只支持5.3以上版本,这里将gcc升级到9. 

    yum install centos-release-scl

    yum install devtoolset-9-gcc*

          scl enable devtoolset-9 bash

之后在执行make命令,问题解决:make 

注意:gcc终于升级好了,这时千万别忘记要进行版本的切换,升级了新版本肯定是使用新版本建议进行永久切换这样,别临时切换完成之后重新连接服务器gcc自己又降回去了
临时切换:scl enable devtoolset-9 bash
永久切换:echo “source /opt/rh/devtoolset-9/enable” >> /etc/profile
切换完成之后重新连接服务器生效,查看gcc版本 gcc -v 

接下来执行如下命令:

[root@localhost redis-6.0.9]# pwd

/data/software/redis-6.0.9 

make install 

redis到此安装完毕,测试下是否安装成功:

出现如下所示,说明成功! 

 

启动redis:

[root@localhost src]# pwd

/data/software/redis-6.0.9/src

[root@localhost src]# ./redis-server /data/software/redis-6.0.9/redis.conf &

 

redis进行简单配置:redis.conf

  1. 以后台进程方式启动
    修改daemonize no 为daemonize yes
  2. 设置redis远程连接
    1)先放行你设置的端口号
    2)注释掉bind 127.0.0.1
    3)设置redis连接密码:在requirepass foobard改为requirepass jxlJXL@123
    jxlJXL@123为设置的密码,这个密码尽量设置复杂些

接下来可以进行简单连接redis测试:

[root@localhost src]# ./redis-cli

127.0.0.1:6379>

如上表示成功!

posted on   永远的大空翼  阅读(312)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
历史上的今天:
2017-01-15 python自动化开发-2
< 2025年3月 >
23 24 25 26 27 28 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
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示