久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Redis 4.0源碼安裝的示例分析

167次閱讀
沒有評論

共計 3675 個字符,預計需要花費 10 分鐘才能閱讀完成。

這篇文章主要介紹了 Redis 4.0 源碼安裝的示例分析,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓丸趣 TV 小編帶著大家一起了解一下。

去官網下載軟件
https://redis.io/download

最新穩定版本是 4.0
上傳到服務器

解壓軟件
[root@MySQL01 ~]# cd /install/
[root@MySQL01 install]# tar xvfz redis-4.0.2.tar.gz

編譯安裝
[root@MySQL01 install]# cd redis-4.0.2
[root@MySQL01 redis-4.0.2]# make

    CC module.o
    CC evict.o
    CC expire.o
    CC geohash.o
    CC geohash_helper.o
    CC childinfo.o
    CC defrag.o
    CC siphash.o
    CC rax.o
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It s a good idea to run make test )
make[1]: Leaving directory `/install/redis-4.0.2/src

啟動 redis
[root@MySQL01 redis-4.0.2]# src/redis-server
[1] 48741
[root@MySQL01 redis-4.0.2]# 48741:C 03 Nov 19:29:48.941 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
48741:C 03 Nov 19:29:48.941 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=48741, just started
48741:C 03 Nov 19:29:48.941 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
48741:M 03 Nov 19:29:48.944 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-“__ -._                                            
      _.-“    `.  `_.   -._           Redis 4.0.2 (00000000/0) 64 bit
  .-“ .-“`.  “`\/    _.,_ -._                                  
 (         ,       .-`  | `,    )     Running in standalone mode
 |`-._`-…-` __…-.“-._| ` _.- |     Port: 6379
 |    `-._   `._    /     _.-    |     PID: 48741
  `-._    `-._  `-./  _.-    _.-                                  
 |`-._`-._    `-.__.-    _.- _.- |                                  
 |    `-._`-._        _.- _.-    |           http://redis.io        
  `-._    `-._`-.__.- _.-    _.-                                  
 |`-._`-._    `-.__.-    _.- _.- |                                  
 |    `-._`-._        _.- _.-    |                                  
  `-._    `-._`-.__.- _.-    _.-                                  
      `-._    `-.__.-    _.-                                      
          `-._        _.-                                          
              `-.__.-                                              

48741:M 03 Nov 19:29:48.950 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
48741:M 03 Nov 19:29:48.950 # Server initialized
48741:M 03 Nov 19:29:48.950 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add vm.overcommit_memory = 1 to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1 for this to take effect.
48741:M 03 Nov 19:29:48.950 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command echo never /sys/kernel/mm/transparent_hugepage/enabled as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
48741:M 03 Nov 19:29:48.950 * DB loaded from disk: 0.000 seconds
48741:M 03 Nov 19:29:48.950 * Ready to accept connections

通過內置的客戶端工具連接到 redis
[root@MySQL01 redis-4.0.2]# src/redis-cli
127.0.0.1:6379 set foo bar
OK
127.0.0.1:6379 get foo
bar

查看進程
[root@MySQL01 redis-4.0.2]# ps -ef|grep redis
root     48741     1  0 Nov03 ?        00:00:25 src/redis-server *:6379

為 Python 3.6.1 語言安裝 Redis 客戶端庫
[root@MySQL01 redis-4.0.2]# pip3 install redis hiredis
Collecting redis
  Downloading redis-2.10.6-py2.py3-none-any.whl (64kB)
    100% |████████████████████████████████| 71kB 107kB/s 
Collecting hiredis
  Downloading hiredis-0.2.0.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 501kB/s 
Installing collected packages: redis, hiredis
  Running setup.py install for hiredis … done
Successfully installed hiredis-0.2.0 redis-2.10.6

通過 Python 3 登錄 Redis
[root@MySQL01 redis-4.0.2]# python
Python 3.6.1 (default, Oct  2 2017, 06:28:48) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type help , copyright , credits or license for more information.
import redis
conn = redis.Redis()
conn.set(hello , world)
True
conn.get(hello)
b world

感謝你能夠認真閱讀完這篇文章,希望丸趣 TV 小編分享的“Redis 4.0 源碼安裝的示例分析”這篇文章對大家有幫助,同時也希望大家多多支持丸趣 TV,關注丸趣 TV 行業資訊頻道,更多相關知識等著你來學習!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-24發表,共計3675字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 安多县| 怀来县| 阿拉善盟| 田东县| 平陆县| 集安市| 南城县| 山东省| 兴和县| 宁阳县| 峡江县| 错那县| 文昌市| 百色市| 隆化县| 江门市| 盱眙县| 屏山县| 乐山市| 滦南县| 乌拉特中旗| 垦利县| 舟山市| 吉林市| 林州市| 彭阳县| 满洲里市| 中山市| 密山市| 两当县| 浪卡子县| 宜兰县| 巴里| 海门市| 乾安县| 札达县| 榆树市| 宣威市| 东台市| 峨眉山市| 青冈县|