ubuntu redis 安装 &基本命令
参考资料: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 安装 &基本命令的更多相关文章
- 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 ...
- ubuntu redis config IP password
ubuntu Redis安装测试.设置用户名密码 - zhangaik的博客 - CSDN博客 https://blog.csdn.net/zhangaik/article/details/79279 ...
- Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)
Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...
- 在Ubuntu中安装Redis
原文地址:http://blog.fens.me/linux-redis-install/ 在Ubuntu中安装Redis R利剑NoSQL系列文章,主要介绍通过R语言连接使用nosql数据库.涉及的 ...
- Ubuntu的Redis安装
转自:http://blog.fens.me/linux-redis-install/ 1. Redis在Windows中安装 在Windows系统上安装Redis数据库是件非常简单的事情,下载可执行 ...
- Ubuntu 18 + Redis安装
Ubuntu 18 + Redis安装 1.安装命令: opengis@gisserver20:~$ sudo apt-get install redis-server 2.查看tcp 连接 open ...
- ubuntu上安装redis
1.Redis简要介绍 访问Redis官方网站 https://redis.io/ 上面介绍到 ,redis是开源,BSD许可,高级的key-value存储系统,可以用来存储字符串,哈希结构,链表,集 ...
- ubuntu下安装redis以及redis客户端在mac下的使用
ubuntu下安装redis http://blog.fens.me/linux-redis-install/ 此方式利用brew安装包去获取最新的rdm客户端 资源失效了 https://www.j ...
- 转】在Ubuntu中安装Redis
不多说,直接上干货! 原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/ 感谢! 在Ubuntu中安装Redis R利剑 ...
随机推荐
- 网站架构(LNMP)
说明: 1)LNMP架构的组成(作用) 2)LNMP架构的部署 3)LNMP架构通讯原理 4)LNMP服务之间如何建立管理 nginx+php 运维负责 php+mysql 开发负责 5) 运 ...
- c#,绝对值
Console.WriteLine("输入任意整数"); var n = int.Parse(Console.ReadLine()); var num = Math.Abs(n); ...
- HTML 5 全局 contenteditable 属性
contenteditable 可以将标签设置为可输入的input,textarea, 但是在ios上,点击或者点击很久input输入框才出来,兼容ios的方法是加一个 -webkit-user- ...
- .NET细节知识总结,不断更新
1.catch (Exception)和catch (Exception e) Exception 类包含许多子类 程序执行的时候要将每一个类都搜索一遍 以找到符合的异常类 这样是蛮消耗资源的 影响效 ...
- 路由器01---k2刷Pandora
1.固件 固件(Firmware)就是写入EPROM(可擦写可编程只读存储器)或EEPROM(电可擦可编程只读存储器)中的程序. 对于独立可操作的电子产品,固件一般指它的操作系统(“担任着一个数码产品 ...
- [DEBUG] ubuntu pip安装成功却无法import
我的pip经常出问题,我也不知道为啥..今天搞啥啥坏=.= 问题: pip自动安装显示成功,在交互环境下却无法import ==========================踩坑========== ...
- (六)Cookie 知识点总结 (来自那些年的笔记)
如果你想要转载话,可不可以不要删掉下面的 作者信息 呀!: 作者:淮左白衣 写于 2018年4月18日18:47:41 来源笔者自己之前学javaWeb的时候,写的笔记 : 目录 如果你想要转载话,可 ...
- Calibre 和 Kindle 配合的使用方法
1. 前言 使用"Calibre"软件,把网上下载的电子书转换成适合kindle阅读的格式. 2. 使用经验总结 2.1 首行缩进.段落间距设置 2.2 输出为mobi格式设置 2 ...
- 解决Cannot change version of project facet Dynamic web module to 2.5(转)
我们用Eclipse创建Maven结构的web项目的时候选择了Artifact Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的,而一 ...
- SQL优化中的重要概念:死锁
原文:SQL优化中的重要概念:死锁 上面几篇文章讲到 事务.锁定.阻塞,最后还有一种比较极端的情况,就是死锁,这也是锁定.阻塞的一种情况. 死锁是当两个事务分别锁定了资源,而又继续请求对方已获取的资源 ...
