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
root@lhdpc:~# apt-get install redis2,检查安装完的效果:
root@lhdpc:~# whereis redis-server redis-server: /usr/bin/redis-server /usr/share/man/man1/redis-server.1.gz3,查看redis版本:
root@lhdpc:~# redis-server -v Redis server v=6.0.15 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=4610f4c3acf7fb254,查看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>
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