Linux连接redis数据库
来源:互联网 发布:淘宝网光威官方旗舰店 编辑:程序博客网 时间:2024/06/05 02:23
redis至少开两个窗口,一个服务器,一个客户端
服务器
解压redis chu@root:~$ cd Desktop/ chu@root:~/Desktop$ tar -zxvf redis-4.0.2.tar.gz -C soft chu@root:~/Desktop$ cd soft chu@root:~/Desktop/soft$ cd redis-4.0.2/查看日志介绍 chu@root:~/Desktop/soft/redis-4.0.2$ vim README.mdmake chu@root:~/Desktop/soft/redis-4.0.2$ make测试make配置 chu@root:~/Desktop/soft/redis-4.0.2$ make test查看文件 chu@root:~/Desktop/soft/redis-4.0.2$ ls进入src chu@root:~/Desktop/soft/redis-4.0.2$ cd src/进入服务器chu@root:~/Desktop/soft/redis-4.0.2/src$ ./redis-server
客户端
客户端进入redis的src chu@root:~$ cd Desktop/ chu@root:~/Desktop$ cd soft chu@root:~/Desktop/soft$ ls jdk-9.0.1 pycharm-2017.2.4 Python-3.6.3 redis-4.0.2 chu@root:~/Desktop/soft$ cd redis-4.0.2/ chu@root:~/Desktop/soft/redis-4.0.2$ ls chu@root:~/Desktop/soft/redis-4.0.2$ cd src/进入客户端 chu@root:~/Desktop/soft/redis-4.0.2/src$ ./redis-cli ping一下,链接服务器 127.0.0.1:6379> ping PONG 测试,set发送信息,get接受信息,set是字典类型 127.0.0.1:6379> set username 'chu' OK 127.0.0.1:6379> get username "chu" 127.0.0.1:6379>
安装驱动
1, 退出src,进入conf chu@root:~/Desktop/soft/redis-4.0.2$ vim redis.conf2, 关掉保护模式(可以让所有人都连接这台主机) 在普通模式下,关闭bind
修改密码
在普通模式下,然后/requirepass搜索,修改密码
完成之后,重启服务器
首先关闭
ctrl+c
然后重启
./redis-server ../redis.conf链接数据库
chu@root:~/Desktop/soft/redis-4.0.2/src$ ./redis-cli -h 192.168.241.132 -p 6379
密码
auto rootroot
python操作Redis1. 创建项目2. 安装驱动程序 - pip install redis - pip install python-redis依赖解决1. 缺少gcc,安装发送的三条依赖 sudo apt-get install libxml2-dev libxslt1-dev python-dev sudo apt-get install zlib1g-dev sudo apt-get install libevent-dev2. python3的依赖 sudo apt install python3-dev3. 如果还是继续gcc,安装所有依赖 sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev python3-dev4. 使用过程中尽量别升级,容易出现版本不匹配情况
''' 链接redis 1,导入redis 2,创建redis客户端 redis.redis redis.strictredis 推荐使用 和sql一样操作基本一样'''#导入库import redis#创建链接client = redis.StrictRedis(host = 'chuhuan',passwd = 'rootroot')print(client.get('name').decode('utf-8'))
阅读全文
0 0
- Linux连接redis数据库
- SpringMVC 连接Redis数据库
- Java连接Redis数据库
- 怎样连接Redis数据库
- linux c++连接redis
- linux上安装redis数据库,并实现 java连接redis一路遇到的错误
- Redis:使用jedis连接redis数据库过程
- 使用redis远程连接数据库
- Node 连接mysql、redis数据库
- Java连接到Redis数据库
- linux 安装redis数据库
- linux 安装redis数据库
- Redis数据库安装(Linux)
- linux系统redis数据库
- linux安装redis,java连接redis
- 【redis】无法连接linux上的redis
- java 连接 linux redis 失
- Linux Redis启用远程连接
- Java笔记------第一弹
- 线性代数的本质
- win10 Ubuntu16.04双系统安装方法
- low people
- ognl # % 的作用(井号,星号,百分号)
- Linux连接redis数据库
- PAT Basic 1029
- 详述Canvas(五)/绘制圆角矩形
- Shell(十)
- 「POJ 3693」Maximum repetition substring
- 11月30日
- 用AudioBuffer里的数据得到音量
- servlet -> (1)
- indexOf和includes的区别