redis安装

redis学习1

1、linux下安装redis

打算安装在 /usr/local/soft/redis

安装包放到 /usr/local/src

配置文件复制到 /usr/local/soft/redis/bin

1、创建目录

mkdir /usr/local/soft/redis

2、进入安装目录

 cd /usr/local/src

3、下载安装包

wget https://download.redis.io/releases/redis-7.0.0.tar.gz    

4、 解压源码包

tar xf redis-7.0.0.tar.gz  

5、进入解压后目录

  cd redis-7.0.0

6、安装到指定目录中

make PREFIX=/usr/local/soft/redis install 

7、将配置文件拷贝到指定目录的bin目录下

cp redis.conf /usr/local/soft/redis/bin/

8.、人工启动

 cd /usr/local/soft/redis/bin
./redis-server /usr/local/soft/redis/bin/redis.conf

9、构建多实例服务启动

配置redis环境变量
vim /etc/profile
··· 开始编译
export REDIS_HOME=/usr/local/soft/redis
export PATH=$PATH:$REDIS_HOME/bin
··· 保存退出
source /etc/profile
echo $PATH

进入目录
cd /usr/local/src/redis-7.0.0/utils
ls
安装实例
./install_server.sh

安装报错

This systems seems to use systemd.
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!

解决办法

vi ./install_server.sh

注释下面代码

注释下面的代码即可

#bail if this system is managed by systemd
#_pid_1_exe="$(readlink -f /proc/1/exe)"
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
#       echo "This systems seems to use systemd."
#       echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
#       exit 1
#fi

重新运行

./install_server.sh

多个实例设置多个端口号

启动后通过多次修改端口号来启动不同的实例

第一个实例:默认端口号为 6379

在这里插入图片描述

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CTbee0sQ-1661727134388)(assets/1661671426720.png)]

查看状态

开机启动目录:/etc/init.d

cd /etc/init.d
ls
service  redis_6379 status

在这里插入图片描述

创建第二个实例端口号为: 6380

cd /usr/local/src/redis-7.0.0/utils
ls
./install_server.sh
输入6380一直回车

在这里插入图片描述

查看服务状态

cd /etc/init.d
ls
service  redis_6380 status

服务安装完毕后,可以使用服务命令操作redis

service redis_6379 start/stop/status

ps -fe | grep redis 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值