参考资料:https://www.cnblogs.com/zongfa/p/7808807.html
redis命令参考:http://doc.redisfans.com/
安装:sudo apt-get install redis-server
安装完成后,Redis服务器会自动启动,我们检查Redis服务器程序
检查服务器进程:ps -aux|grep redis
检查Redis服务器状态:netstat -nlt|grep 6379
通过启动命令检查Redis服务器状态:sudo /etc/init.d/redis-server status
安装Redis服务器,会自动地一起安装Redis命令行客户端程序

重启Redis服务器:sudo /etc/init.d/redis-server restart

配置文件:/etc/redis/redis.conf

先关闭再重启
[root@localhost src]# redis-cli  #开始客户端连接
127.0.0.1:> auth <span class="space" style="display:inline-block;text-indent:2em;line-height:inherit;"> </span>#auth 密码登录
OK
127.0.0.1:> shutdown save #shutdown 关闭服务 save
not connected> exit # not connected 表示连接已经失去, exit 退出
[root@localhost src]#
[root@loca [root@localhost src]# ps -ef | grep redis- # ps 查找进程 redis-server 真的关闭了
root          : pts/    :: grep --color=auto redis-
[root@localhost src]# redis-server ../redis.conf  #重启
---------------------
作者:1990_super
来源:CSDN
原文:https://blog.csdn.net/runbat/article/details/79248527
版权声明:本文为博主原创文章,转载请附上博文链接!
from redis import StrictRedis

# 使用默认方式连接到数据库
redis = StrictRedis(host='localhost', port=, db=) # 使用url方式连接到数据库
redis = StrictRedis.from_url('redis://@localhost:6379/1')
from redis import StrictRedis,ConnectionPool

# 使用默认方式连接到数据库
pool = ConnectionPool(host='localhost', port=, db=)
redis = StrictRedis(connection_pool=pool) # 使用url方式连接到数据库
pool = ConnectionPool.from_url('redis://@localhost:6379/1')
redis = StrictRedis(connection_pool=pool)
redis://[:password]@host:port/db    # TCP连接
rediss://[:password]@host:port/db # Redis TCP+SSL 连接
unix://[:password]@/path/to/socket.sock?db=db # Redis Unix Socket 连接
redis-load -h   # 获取帮助信息

< redis_data.json redis-load -u redis://@localhost:6379  # 将json数据导入数据库中
redis-dump -h  # 获取帮助信息

redis-dump -u redis://@localhost:6379 -d 1 > ./redis.data.jl  # 导出到json文件
redis-dump -u redis://@localhost:6379 -f adsl:* > ./redis.data.jl # 导出adsl开头的数据

=======================

打印出所有[与pattern相匹配的]活跃频道:PUBSUB CHANNELS [pattern]    活跃频道指的是那些至少有一个订阅者的频道
订阅频道的订阅者数量:PUBSUB NUMSUB channel1 channel2
返回客户端订阅的所有模式的数量总和:PUBSUB NUMPAT

# client- 订阅 news.* 和 discount.* 两个模式

client-> PSUBSCRIBE news.* discount.*
Reading messages... (press Ctrl-C to quit)
) "psubscribe"
) "news.*"
) (integer)
) "psubscribe"
) "discount.*"
) (integer) # client- 订阅 tweet.* 一个模式 client-> PSUBSCRIBE tweet.*
Reading messages... (press Ctrl-C to quit)
) "psubscribe"
) "tweet.*"
) (integer) # client- 返回当前订阅模式的数量为 client-> PUBSUB NUMPAT
(integer) # 注意,当有多个客户端订阅相同的模式时,相同的订阅也被计算在 PUBSUB NUMPAT 之内
# 比如说,再新建一个客户端 client- ,让它也订阅 news.* 频道 client-> PSUBSCRIBE news.*
Reading messages... (press Ctrl-C to quit)
) "psubscribe"
) "news.*"
) (integer) # 这时再计算被订阅模式的数量,就会得到数量为 client-> PUBSUB NUMPAT
(integer)
 



ubuntu redis 安装 &基本命令的更多相关文章

  1. ubuntu Redis安装及配置

    1.安装 1.1 下载压缩包:wget http://download.redis.io/releases/redis-5.0.4.tar.gz1.2 解压:tar xzf redis-5.0.4.t ...

  2. ubuntu redis config IP password

    ubuntu Redis安装测试.设置用户名密码 - zhangaik的博客 - CSDN博客 https://blog.csdn.net/zhangaik/article/details/79279 ...

  3. Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)

    Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...

  4. 在Ubuntu中安装Redis

    原文地址:http://blog.fens.me/linux-redis-install/ 在Ubuntu中安装Redis R利剑NoSQL系列文章,主要介绍通过R语言连接使用nosql数据库.涉及的 ...

  5. Ubuntu的Redis安装

    转自:http://blog.fens.me/linux-redis-install/ 1. Redis在Windows中安装 在Windows系统上安装Redis数据库是件非常简单的事情,下载可执行 ...

  6. Ubuntu 18 + Redis安装

    Ubuntu 18 + Redis安装 1.安装命令: opengis@gisserver20:~$ sudo apt-get install redis-server 2.查看tcp 连接 open ...

  7. ubuntu上安装redis

    1.Redis简要介绍 访问Redis官方网站 https://redis.io/ 上面介绍到 ,redis是开源,BSD许可,高级的key-value存储系统,可以用来存储字符串,哈希结构,链表,集 ...

  8. ubuntu下安装redis以及redis客户端在mac下的使用

    ubuntu下安装redis http://blog.fens.me/linux-redis-install/ 此方式利用brew安装包去获取最新的rdm客户端 资源失效了 https://www.j ...

  9. 转】在Ubuntu中安装Redis

    不多说,直接上干货! 原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/ 感谢! 在Ubuntu中安装Redis R利剑 ...

随机推荐

  1. Extjs 中combobox下拉框初始化赋值

    近日在工作中遇到一个需求,要求页面初始化的时候给dataGrid表插入一条数据. 前端使用的是Extjs框架,dataGrid表有四列,其中三列是类型为textbox,普通文本框,另外一列类型是com ...

  2. FastJson反序列化获取不到值

    今天碰到一个问题,使用fastjson反序列化,就是将JSON解析成javaBean时,一个字段值为null.后面经查,是JavaBean中的set方法写错了,fastJson解析的是利用反射通过se ...

  3. Java基础---Java三元运算

    一元运算符:只需要一个数据就可以进行操作的运算符.例如:取反!.自增++.自减--二元运算符:需要两个数据才可以进行操作的运算符.例如:加法+.赋值=三元运算符:需要三个数据才可以进行操作的运算符. ...

  4. Spring Boot系列教程十二:Spring boot集成Redis

    一.创建项目 项目名称为 "springboot_redis",创建过程中勾选 "Web","Redis",第一次创建Maven需要下载依赖 ...

  5. # VsCode 配置C++调试运行

    VsCode 配置C++调试运行 打开命令面板快捷键为F1,软件上写的Ctrl+Shift+P似乎没用 先安装插件使得可以运行 先自行在vsc扩展中搜索C++安装C/C++插件 再参考知乎专栏中安装c ...

  6. qt聊天室bug-- error: no matching function for call to 'Ui::Widget::setupUi(Widget*)' ui->setupUi(this); ^

  7. Nginx学习笔记(二):Nginx 连接处理 / 负载均衡

    Connection 在 Nginx 中,connection 就是对 TCP 连接的封装,其中包括连接的 socket,读写事件   Nginx 处理连接流程: 解析配置文件,得到需要监听的端口和I ...

  8. 官网下载CentOS教程(各版本)

    1.进入官网,并点击下图所示的红框(alternative downloads) 官网网址:https://www.centos.org/download/  2.在往下翻,可以看到如下图的历史版本, ...

  9. (十三)JSON的使用(下)

    (接上一章节) 4.2 使用ajax交互方式 使用ajax的转换思想        A:异步请求在页面中发起,也要在页面中接收数据并展现. B:ajax中的数据不能从作用域中获取,只能从respons ...

  10. (十六)SpringBoot之使用 Caching- - EhCache

    一.案例 1.1 引入maven依赖 <!-- caching --> <dependency> <groupId>org.springframework.boot ...