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利剑 ...
随机推荐
- HTML让字体闪动和滚动显示
存粹的HTML让字体闪动显示: <html> <head> <title>TEST</title> <style type="text/ ...
- jqGrid取消所有选中
// 获取所有选中行id var jqGridRowid=$("#jqGrid").jqGrid("getGridParam","selarrrow& ...
- Java 应用程序的运行机制
计算机高级语言: 编译型 (C) 解释性(JS)Java 使两种类型的结合 java 编译器 class \|/jvm ...
- js 读取文本文件,日志内容
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- The request was aborted: Could not create SSL/TLS secure channel
一.背景: 公司底层服务CDN从Akamai迁移到阿里云之后, 使用该服务的一个应用报错如下: System.AggregateException: One or more errors occurr ...
- java中this的使用
java中的this随处可见,用法也多,现在整理有几点:this1.当全局变量跟局部变量重名时,表示使用全局变量(此时this指代本类对象)例有一类class A{ String name; ...
- docker容器端口号、时区修改
一.修改端口号 在docker run创建并运行容器的时候,可以通过-p指定端口映射规则.但是,我们经常会遇到刚开始忘记设置端口映射或者设置错了需要修改.当docker start运行容器后并没有提 ...
- SQL数据库基础语法
SQL语句的概述 SQL语言的分类 数据定义语言(Data Definition Language)主要用于修改.创建和删除数据库对象,其中包括CREATE ALTER DROP语句. 数据查询语 ...
- 开始使用 git(配置+常用命令)
▶ 注意 页面显示问题: -- 是两个短横线 - 是一个横短线 由于显示问题导致两个短横线之间没有空格,看起来像是一条横线,实则是两条短横线 ▶ git 常用命令 ◆ git add ● git ad ...
- Python学习5——抽象,涉及抽象和结构、函数的自定义、参数、作用域、递归
此处将抽象和结构.自定义函数.参数的使用.作用域.递归放在一起学习,看起来很怪是不是? 但实际上这几者之间是有紧密联系的,不然Python基础教程(第三版)的作者为什么会把它们放在一起哪?手动滑稽 好 ...
