当前位置:网站首页>一台Linux机器上启动多个redis实例
一台Linux机器上启动多个redis实例
2022-07-23 15:05:00 【pilaf1990】
说明:磁盘上的redis程序只有一份,可以启动多个redis实例,每个实例的端口不一样。
进入redis官网找到要下载的版本:https://redis.io/download
先在linux机器上安装gcc(用yum install gcc安装),如果没安装的话后续make会报错。
比如我要安装在/root/software目录下,进入该目录。
- 1.下载tar包
wget http://download.redis.io/releases/redis-5.0.9.tar.gz - 2.解压tar包
tar xf redis-5.0.9.tar.gz - 3.执行make
cd redis-5.0.9
make (如果没安装gcc会报错,可以先执行yum install gcc安装gcc,然后执行make distclean把之前make产生的脏文件清除) - 4.执行make install
make install PREFIX=/root/software/redis5 - 5.修改/etc/profile
vi /etc/profile
在/etc/profile中增加如下内容
export REDIS_HOME=/root/software/redis5
export PATH=${REDIS_HOME}/bin:${PATH}
然后保存退出,别忘了执行source /etc/profile - 6.执行install_server.sh脚本
cd utils
./install_server.sh
后面会要求输入端口号,不输入就回车的话就默认6379。后面一路回车。
这个脚本可以执行多次,每执行一次就开启一个redis实例。
可以通过ps -ef | grep redis命令查看启动了多少个redis实例:
[[email protected] utils]# ps -ef | grep redis
root 11851 1 0 10:23 ? 00:00:03 /root/software/redis5/bin/redis-server 127.0.0.1:6379
root 11920 1 0 10:23 ? 00:00:03 /root/software/redis5/bin/redis-server 127.0.0.1:6380
root 12006 11981 0 11:17 pts/1 00:00:00 grep --color=auto redis
- 7.测试redis
[[email protected] utils]# redis-cli -p 6380
127.0.0.1:6380>
127.0.0.1:6380> set mykey myvalue
OK
127.0.0.1:6380> get mykey
"myvalue"
127.0.0.1:6380>
参考:马士兵大学周志垒Redis系列教程
边栏推荐
- Kv260 single board PS control setting IIC switch chip
- 面试官:MySQL 数据库查询慢,除了索引问题还可能是什么原因?
- At least half of the people can't answer the difference between isempty and isblank
- Food safety | eight things you must know when choosing probiotic products
- 日期格式化
- nVisual综合布线管理软件与网管软件的区别
- “如今,代码数已膨胀至天文级别”
- 不掌握这些坑,你敢用BigDecimal吗?
- Literature learning (part100) -- an introduction to autoencoders
- 【redis入门系列】redis的数据类型及相关命令
猜你喜欢

Differences between nvisual generic cabling management software and network management software

Données chronologiques dans l'Internet industriel des objets

@Bean 注解的方法调用多次会创建多个bean 实例吗

el-input使用

使用moment获取当天日期与下一天

Console calculator developed based on C language

Transfer business append log (transaction propagation behavior)

网络基础设施可视化

USB Type-C PD CC逻辑芯片中的角色定义

Tapdata 与优炫数据库完成产品兼容性互认证
随机推荐
JDBC program example using Preparedstatement
ride the wind and waves! Digital transformation in the era of financial technology
工作常用操作
LQR control learning -lqr control matlab official tutorial -lqr controller_ Modeling and analysis of state space system with matlab/simulink
Console calculator developed based on C language
Analyze optimism replay contract address attack events
Do you really understand the persistence mechanism of redis?
Element content must consist of character data or tags with correct format
Leetcode skimming: dynamic programming 05 (different paths II)
leetcode刷题:动态规划04(不同路径)
At least half of the people can't answer the difference between isempty and isblank
Food safety | eight things you must know when choosing probiotic products
Solutions to sap Hana database backup failure
分析optimism重放合约地址攻击事件
Can debug/release versions of dynamic library *.dll files be mixed (cross used)?
【flask高级】从源码深入理解flask路由之endpoint
基于scrapy的电商平台数据爬取与展示
[introduction series of redis] redis builds master-slave servers
Unity production QR code scanning
Leetcode skimming: dynamic planning 04 (different paths)