参考资料: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. C#基础知识学习 三

  2. C#学习笔记06--类/对象/访问修饰符/方法

    编程思想   1.面向过程   面向过程是要把问题解决的过程分成有一定顺序的不同步骤, 然后按照步骤一步步的将问题解决.   2.面向对象   面向对象解决问题的思路是先分析问题中所涉及的对象, 然后 ...

  3. Mysql: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

    2019-05-28 01:53:42.762 [message remind thread-24] ERROR druid.sql.Statement - {conn-10327, stmt-320 ...

  4. logback日志输出至数据库

    我们知道将数据库输出到不同的地方需要使用不同的appender表示,那下面了解一下输出到数据库的DBAppender. 1.DBAppender 由于DBAppender会把记录写到数据库中,因此我们 ...

  5. Calibre 和 Kindle 配合的使用方法

    1. 前言 使用"Calibre"软件,把网上下载的电子书转换成适合kindle阅读的格式. 2. 使用经验总结 2.1 首行缩进.段落间距设置 2.2 输出为mobi格式设置 2 ...

  6. C++实现16进制字符串转换成int整形值

    开发中经常需要把16进制字符串转换成整形,写了个个代码供大家参考下: #include <stdio.h> #include <string.h> //字符转换成整形 int ...

  7. MongoDB journal 与 oplog,究竟谁先写入?--转载

    MongoDB journal 与 oplog,谁先写入?最近经常被人问到,本文主要科普一下 MongoDB 里 oplog 以及 journal 这两个概念. journal journal 是 M ...

  8. ASP.NET WEB应用程序(.network4.5)MVC Razor视图引擎2 动态数据的呈现

    https://www.cnblogs.com/cynchanpin/p/7065098.html 在MVC3開始.视图数据能够通过ViewBag属性訪问.在MVC2中则是使用ViewData.MVC ...

  9. javascript--BOM(browser object model)五大对象

    浏览器对象模型: 作用:访问.控制.修改浏览器,与浏览器进行交互(打开新的窗口.回退历史记录.获取url) BOM与的DOM区别:JS通过BOM与浏览器进行交互.BOM的window对象包含了docu ...

  10. HashMap、HashTable差异详解

    HashMap和HashTable有什么不同?在面试和被面试的过程中,我问过也被问过这个问题,也见过了不少回答,今天决定写一写自己心目中的理想答案. 代码版本 JDK每一版本都在改进.本文讨论的Has ...