环境篇之 redis 的 linux 和 Windows 测试|学习笔记

简介: 快速学习环境篇之 redis 的 linux 和 Windows 测试

开发者学堂课程【大数据 Flink 实时旅游平台环境篇 2020版:环境篇之 redis 的linux 和 Windows 测试】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址https://developer.aliyun.com/learning/course/643/detail/10705


环境篇之 redis 的 linux 和 Windows 测试

内容介绍:

一、做配置文件

二、开机自启动

三、启动测试


一、做配置文件

vi ./redis

先来做一个启动的配置文件,可以直接启动,此处讲解做一个配置文件

内容如下,可以直接复制

#!/bin/bash

#chkconfig: 2345 80 90

# Simple Redis init.d script conceived to work on Linux systems

# as it does use of the /proc filesystem.

PATH=/usr / local/bin:/sbin :/usr/bin:/bin

REDISPORT=6379

EXEC=/usr /local/redis-4.0.11/bin/redis-server

REDIS_CLI=/usr /local /redis-4.0.11/bin/redis-cli

PIDFILE=/var/run/redis.pid

CONF="/usr /local/redis-4.0.11/etc/redis.conf"

case "$1" in

start)

if [ -f $PIDFILE ]

then

echo "SPIDFILE exists,process is already running or crashed"

else

echo “Starting Redis server...”

$EXEC $CONF

fi

if [“$?”=”0”]

then

echo “Redis is running”

fi

;;

stop)

if [ ! -f $PIDFILE]

then

echo”$PIDFILE does not exist,process is not running ”

else

PID=$(cat $PIDFILE)

echo “Stopping...”

$REDIS_CLI -p $REDISPORT SHUTDOWN

while [-x ${PIDFILE}]

do

echo “Waiting for Redis to shutdown...”

done

echo “Redis stopped”

fi

restart|force-reload)

${0} stop

${0} start

;;

echo “Usage:  

/etc/init.d/redis {start|stop|restart|force-reload}” >&2

exit 1

esac

二、开机自启动

之后需要设置开机自启动:

#复制脚本文件到 init.d 目录下

cp redis /etc/init.d/

#给脚本增加运行权限

chmod +x /etc/init.d/redis

#查看服务列表

chkconfig --list

#添加服务

chkconfig --add redis

#配置启动级别

chkconfig --level 2345 redis on

三、启动测试

再来进行启动测试:

Linux 端测试

systemctl start redis#或者

/etc/init.d/redis start[root@hadoop01 redis-4.0.11]# systemct1 stop redis#或者/etc/init.d/redis stop

启动之后可以输入以下查看 redis 进程:

ps -ef l grep redis

结果可以看到默认端口6379

也可以使用 netstat 查看端口是否启动,如下:

netstat -an | grep 6379

完成后进行客户端连接测试:输入

redis-cli -h hadoop01

进入后输入 auth root 为 OK

输入keys 密码

设置值输入set r1 redis1

再输入get r1

结果显示”redis1”代表测试成功

再来输入 ping 会自动返回一个 PONG

Windows 端

在本机中打开软件 redis-desktop-manager-0.8.0.3841.exe

进行安装,Destination Folder 为

D:\installed\RedisDesktopManger

安装到桌面后点击软件,如图

image.png

点击 Connect to Redis Server

输入name为hadoop-redis

Host 为192.168.216.111

Auth 为 root

然后点击测试 Test Connection,显示成功连接点击 OK

之后点击 hadoop-redis 可以看到默认是16个库

image.png

点击 db0,点击 r1 右侧就会显示 value 值:redis1

相关文章
|
9月前
|
安全 Linux 生物认证
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
367 0
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
|
9月前
|
安全 Linux iOS开发
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
792 53
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
|
9月前
|
安全 Linux 生物认证
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
423 17
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
|
9月前
|
SQL 安全 Linux
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
455 1
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
|
9月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
1052 1
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
|
9月前
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
1924 0
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
9月前
|
Linux iOS开发 计算机视觉
GIMP 3.0.6 (Linux, macOS, Windows) 发布 - 免费开源图像编辑器
GIMP 3.0.6 (Linux, macOS, Windows) 发布 - 免费开源图像编辑器
648 0
|
NoSQL Redis Windows
Windows 下安装Redis
Windows 下安装Redis
256 0
Windows 下安装Redis
|
NoSQL Redis
windows32位下安装Redis
windows32位下安装Redis
679 0
windows32位下安装Redis