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

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云数据库 Tair(兼容Redis),内存型 2GB
简介: 快速学习环境篇之 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

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
26天前
|
安全 Unix Linux
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
44 5
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
|
29天前
|
安全 前端开发 Linux
Immunity CANVAS Professional 7.27 (macOS, Linux, Windows) - 渗透测试和漏洞利用平台
Immunity CANVAS Professional 7.27 (macOS, Linux, Windows) - 渗透测试和漏洞利用平台
62 3
Immunity CANVAS Professional 7.27 (macOS, Linux, Windows) - 渗透测试和漏洞利用平台
|
29天前
|
安全 测试技术 Linux
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
73 2
Flawnter 5.9.1 (macOS, Linux, Windows) - 应用程序安全测试软件
|
1月前
|
人工智能 安全 网络安全
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
100 4
Burp Suite Professional 2025.5 for Windows x64 - 领先的 Web 渗透测试软件
|
1月前
|
数据采集 安全 Linux
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
40 4
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
|
1月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
43 4
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
|
29天前
|
安全 算法 Ubuntu
Linux(openssl)环境:编程控制让证书自签的技巧。
总结:在Linux环境中,OpenSSL是一个非常实用的工具,可以帮助我们轻松地生成自签名证书。通过上述三个简单步骤,即可为内部网络、测试环境或开发环境创建自签名证书。但在公共访问场景下,建议购买经过权威认证机构签发的证书,以避免安全警告。
70 13
|
29天前
|
关系型数据库 MySQL Java
安装和配置JDK、Tomcat、MySQL环境,以及如何在Linux下更改后端端口。
遵循这些步骤,你可以顺利完成JDK、Tomcat、MySQL环境的安装和配置,并在Linux下更改后端端口。祝你顺利!
122 11
|
1月前
|
消息中间件 NoSQL Linux
Redis的基本介绍和安装方式(包括Linux和Windows版本),以及常用命令的演示
Redis(Remote Dictionary Server)是一个高性能的开源键值存储数据库。它支持字符串、列表、散列、集合等多种数据类型,具有持久化、发布/订阅等高级功能。由于其出色的性能和广泛的使用场景,Redis在应用程序中常作为高速缓存、消息队列等用途。
355 16
|
29天前
|
安全 Devops 测试技术
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
42 0
AppSpider 7.5.018 for Windows - Web 应用程序安全测试

热门文章

最新文章

下一篇
oss创建bucket