redis安装步骤

安装流程

1、安装上传的文件的插件

命令:

yum -y install lrzsz

redis安装步骤_第1张图片

2、解压压缩文件

命令:

tar -zxvf redis-6.2.2.tar.gz -C /usr/local/

3、查询解压文件,进入解压目录

命令:

cd /usr/local/redis-6.2.2/

4、配置环境(安装gcc),进入到目录中

查询命令:

gcc -v

安装命令:

yum install -y gcc

命令:

[root@host-003 redis-6.2.2]# yum install -y gcc

[root@host-003 redis-6.2.2]# gcc -v

redis安装步骤_第2张图片

4、编译文件(/usr/local/redis-6.2.2)

编译命令:

make && make install

完成地址:

[root@host-003 redis-6.2.2]# make && make install

redis安装步骤_第3张图片

5、内存分配(/usr/local/redis-6.2.2)

设置命令:

echo "vm.overcommit_memory=1" >> /etc/sysctl.conf

查询命令:

/sbin/sysctl -p

redis安装步骤_第4张图片

6、创建目录

设置命令:

mkdir -p /usr/local/redis/{bin,conf}

查询命令:

cd /usr/local/redis

redis安装步骤_第5张图片

7、复制启动项

复制server

cp /usr/local/redis-6.2.2/src/redis-server /usr/local/redis/bin/

复制cli

cp /usr/local/redis-6.2.2/src/redis-cli /usr/local/redis/bin/

复制benchmark

cp /usr/local/redis-6.2.2/src/redis-benchmark /usr/local/redis/bin/

复制conf

cp /usr/local/redis-6.2.2/redis.conf /usr/local/redis/conf

8、设置数据库存储位置

设置命令:

mkdir -p /usr/local/redis/{run,logs,dbcache}

查询命令:

cd /usr/local/redi

redis安装步骤_第6张图片

9、配置conf文件

a.外部访问注释

bind 0.0.0.1

b.端口

port 6379

c.后台运行

daemonize yes

d.运行地址

pidfile /usr/local/redis/run/redis_6379.pid

e.日志

logfile "/usr/local/redis/logs/redis_6379.log"

f.文件存储文档

dir /usr/local/redis/dbcache

g.保护模式

protected-mode no

10、启动

设置命令:

/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis_6379.conf

===========================================================

其他处理

1.配置启动服务

vim /etc/systemd/system/redis.service

[Unit] Description=redis-server After=network.target

[Service] Type=forking

ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis_6379.conf PrivateTmp=true

[Install] WantedBy=multi-user.target

启动配置

[root@localhost bin]# systemctl daemon-reload

[root@localhost bin]# systemctl start redis.service

[root@localhost bin]# systemctl stop redis.service

[root@localhost bin]# systemctl enable redis.service

[root@localhost bin]# systemctl status redis.service

2.设置启动脚本:

vim nodes-start.sh

#!/bin/bash /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis_6379.conf /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis_6380.conf

#设置权限

sudo chmod -R 777 nodes-start.sh

vim /etc/systemd/system/redis.service

[Unit] Description=redis-server After=network.target

[Service] Type=forking ExecStart=/usr/local/redis/nodes-start.sh

PrivateTmp=true

[Install] WantedBy=multi-user.target

重载系统服务:

systemctl daemon-reload

设置开机自启

systemctl enable redis

启动

systemctl start redis.service

关闭:

systemctl disable

# Redis线程池配置 maxclients 20000

# 最大客户端连接数 worker-threads 4

# 普通工作线程数 io-threads 4

# 后台工作线程数 io-threads-do-reads yes

# 开启后台线程IO读取 io-threads-do-writes yes

# 开启后台线程IO写入

你可能感兴趣的:(redis,oracle,数据库)