Redis教程

linux(ubuntu21.10):apt方式安装redis6.0.15

本文主要是介绍linux(ubuntu21.10):apt方式安装redis6.0.15,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一,查看是否已安装redis

1,redis官网:
https://redis.io/
2,检查是否已安装:
root@lhdpc:~# whereis redis-server
redis-server:

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,apt方式安装redis6:

1,安装
root@lhdpc:~# apt-get install redis
2,检查安装完的效果:
root@lhdpc:~# whereis redis-server
redis-server: /usr/bin/redis-server /usr/share/man/man1/redis-server.1.gz
3,查看redis版本:
root@lhdpc:~# redis-server -v
Redis server v=6.0.15 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=4610f4c3acf7fb25
4,查看redis服务的状态:
root@lhdpc:~# systemctl status redis.service
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-12-27 10:09:00 CST; 3min 45s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 1790 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 4588)
     Memory: 2.5M
        CPU: 602ms
     CGroup: /system.slice/redis-server.service
             └─1790 /usr/bin/redis-server 127.0.0.1:6379
 
12月 27 10:09:00 lhdpc systemd[1]: Starting Advanced key-value store...
12月 27 10:09:00 lhdpc systemd[1]: Started Advanced key-value store.
可见已处于启动状态   5,查看redis绑定的端口:
root@lhdpc:~# ss -lntp | grep redis
LISTEN 0      511        127.0.0.1:6379       0.0.0.0:*    users:(("redis-server",pid=1790,fd=6))                                            
LISTEN 0      511            [::1]:6379          [::]:*    users:(("redis-server",pid=1790,fd=7)) 

三,测试安装效果

root@lhdpc:~# redis-cli
127.0.0.1:6379> get a
(nil)
127.0.0.1:6379> set a "this is a"
OK
127.0.0.1:6379> get a
"this is a"
127.0.0.1:6379>

 

四,查看linux的版本:

root@lhdpc:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 21.10"
NAME="Ubuntu"
VERSION_ID="21.10"
VERSION="21.10 (Impish Indri)"
VERSION_CODENAME=impish
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=impish

 

这篇关于linux(ubuntu21.10):apt方式安装redis6.0.15的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!