部署环境说明
[bigdata@vm6 ~]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[bigdata@vm6 ~]$
下载安装包
在浏览器中进入https://redis.io/download/#redis-stack-downloads
,打开下载页面,点击对应的版本进行安装包的下载。
也可以在Linux的终端上直接下载。
wget https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
wget https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-RC2.rhel7.x86_64.tar.gz
如:
[bigdata@vm6 ~]$ wget https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
--2023-07-06 13:56:35-- https://packages.redis.io/redis-stack/redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
Resolving packages.redis.io (packages.redis.io)... 13.225.183.121, 13.225.183.114, 13.225.183.125, ...
Connecting to packages.redis.io (packages.redis.io)|13.225.183.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29799263 (28M) [application/gzip]
Saving to: ‘redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz’
100%[===============================================================================>] 29,799,263 12.1MB/s in 2.4s
2023-07-06 13:56:39 (12.1 MB/s) - ‘redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz’ saved [29799263/29799263]
[bigdata@vm6 ~]$
上传和解压
tar xzf redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
mv redis-stack-server-6.2.6-v7 redis-6.2.6
演示如下:
[bigdata@vm6 ~]$ ll redis*
-rw-rw-r-- 1 bigdata bigdata 29799263 Apr 25 16:45 redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
[bigdata@vm6 ~]$ tar xzf redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
[bigdata@vm6 ~]$ ls
a.txt hbase-1.1.1 node Templates
build hive-2.3.9 node.tar tmp
Desktop jdk-11.0.18 Pictures Videos
Documents jdk-11.0.18_linux-x64_bin.tar.gz Public zookeeper-3.4.6
Downloads jdk1.8.0_20 redis-stack-server-6.2.6-v7 zookeeper.out
elasticsearch-6.8.23 kafka-2.6.0 redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
etl maven-3.3.3 setup
hadoop-2.6.0 Music spark-2.3.3
修改redis
的安装目录名。
[bigdata@vm6 ~]$ mv redis-stack-server-6.2.6-v7 redis-6.2.6
[bigdata@vm6 ~]$ ls
a.txt hbase-1.1.1 node Templates
build hive-2.3.9 node.tar tmp
Desktop jdk-11.0.18 Pictures Videos
Documents jdk-11.0.18_linux-x64_bin.tar.gz Public zookeeper-3.4.6
Downloads jdk1.8.0_20 redis-6.2.6 zookeeper.out
elasticsearch-6.8.23 kafka-2.6.0 redis-stack-server-6.2.6-v7.rhel7.x86_64.tar.gz
etl maven-3.3.3 setup
hadoop-2.6.0 Music spark-2.3.3
[bigdata@vm6 ~]$
配置环境变量
将redis
的安装路径加入环境变量PATH
中。
[bigdata@vm6 ~]$ tail .bash_profile
export SPARK_HOME=/home/bigdata/spark-2.3.3
export HBASE_HOME=/home/bigdata/hbase-1.1.1
export MAVEN_HOME=/home/bigdata/maven-3.3.3
export KAFKA_HOME=/home/bigdata/kafka-2.6.0
export NODE_HOME=/home/bigdata/node
export ELASTICSEARCH_HOME=/home/bigdata/elasticsearch-6.8.23
export REDIS_HOME=/home/bigdata/redis-6.2.6
PATH=$REDIS_HOME/bin:$ELASTICSEARCH_HOME/bin:$KAFKA_HOME/bin:$NODE_HOME/bin:$MAVEN_HOME/bin:$ZOOKEEPER_HOME/bin:$HIVE_HOME/bin:$SPARK_HOME/bin:$SPARK_HOME/sbin:$HBASE_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$JAVA_HOME/bin:$PATH
[bigdata@vm6 ~]$
运行Redis
[bigdata@vm6 ~]$ redis-server ./redis-6.2.6/etc/redis-stack.conf
可以通过ps
命令查看redis
是否运行。
[bigdata@vm6 ~]$ ps -ef | grep redis
bigdata 4926 1 0 16:20 ? 00:00:00 redis-server *:6379
bigdata 4951 4741 0 16:21 pts/2 00:00:00 grep --color=auto redis
[bigdata@vm6 ~]$
上面的命令可以看到redis
的端口值为6379
。文章来源:https://www.toymoban.com/news/detail-534149.html
这个端口值是在配置文件中默认指定的。文章来源地址https://www.toymoban.com/news/detail-534149.html
[bigdata@vm6 ~]$ cat ./redis-6.2.6/etc/redis-stack.conf
port 6379
daemonize yes
[bigdata@vm6 ~]$
测试
[bigdata@vm6 ~]$ redis-cli
127.0.0.1:6379> set "user001" "jihui"
OK
127.0.0.1:6379> set "user002" "redis"
OK
127.0.0.1:6379> keys *
1) "user002"
2) "user001"
127.0.0.1:6379> get "user001"
"jihui"
127.0.0.1:6379>
到了这里,关于如何部署一个最简单的Redis测试环境的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!