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利剑 ...
随机推荐
- TCP通信的文件上传案例
- S2. Android 常用控件
[概述] Button(普通按钮):点击事件处理 Toast(消息提示) Menu(菜单): Menu + Fragment 实现菜单切换 [Button] 在 MainActivity 对应的布局文 ...
- js时间戳与日期格式之间相互转换
###js时间戳与日期格式之间相互转换 将时间戳转换成日期格式 // 简单的一句代码 var date = new Date(时间戳); //获取一个时间对象 /** 1. 下面是获取时间日期的方法, ...
- 【BFS】Help the Princess!
题目描述 The people of a certain kingdom make a revolution against the bad government of the princess. T ...
- 将dubbo中使用的动态代理作为工具类
ReflectUtils package per.qiao.util.javassistUtil; import java.lang.reflect.Constructor; import java. ...
- Java 中的锁原理、锁优化、CAS、AQS 详解!
来源:jianshu.com/p/e674ee68fd3f 1.为什么要用锁? 锁-是为了解决并发操作引起的脏读.数据不一致的问题. 2.锁实现的基本原理 2.1.volatile Java编程语言允 ...
- (三)springmvc之注解的基本使用
一.@Controller @Controller 标记一个类是Controller 二.RequestMapping 地址映射 2.1 Value的操作. 注解在类上面 (父) ...
- Windows 服务 安装后自启动
[RunInstaller(true)] public partial class ProjectInstaller : System.Configuration.Install.Installer ...
- legacy
int bw = blockDim.x; int bh = blockDim.y; int tx = threadIdx.x%bw; int ty = threadIdx.y%bh; __shared ...
- 关于微信小程序的父子组件互相传值
一:父组件传值给子组件 1. 在父组件中引用子组件 1.1 在父组件json中导入子组件 1.2 在子组件的json中,把自己定义为子组件 2. 在父组件中,子组件的引用处,绑定一个属性( text ...
