txp · 2020年10月12日

云芯一号评测--redis的安装和使用

前言

测试文章拖的有点久,非常不好意思;本篇文章给大家测试的是在云芯一号上安装redis,以及它的使用!:

image.png

redis闪亮登场

1、下载redis

这里我建立了一个redis文件夹,来专门下载redis源文件:

jishu@Jishu:~$ ls
redis
jishu@Jishu:~$ cd redis/
jishu@Jishu:~/redis$ wget http://download.redis.io/releases/redis-6.0.3.tar.gz
--2020-10-11 18:47:47--  http://download.redis.io/releases/redis-6.0.3.tar.gz
Resolving download.redis.io (download.redis.io)... 45.60.125.1
Connecting to download.redis.io (download.redis.io)|45.60.125.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2210882 (2.1M) [application/octet-stream]
Saving to: 'redis-6.0.3.tar.gz'

redis-6.0.3.tar.gz          100%[==========================================>]   2.11M  51.0KB/s    in 24s     ==

2020-10-11 18:48:13 (89.3 KB/s) - 'redis-6.0.3.tar.gz' saved [2210882/2210882]

然后进行解压:

jishu@Jishu:~/redis$ tar zxvf redis-6.0.3.tar.gz 
redis-6.0.3/
redis-6.0.3/.github/
redis-6.0.3/.github/workflows/
redis-6.0.3/.github/workflows/ci.yml
redis-6.0.3/.github/workflows/daily.yml
redis-6.0.3/.gitignore
redis-6.0.3/00-RELEASENOTES
redis-6.0.3/BUGS
redis-6.0.3/CONTRIBUTING
redis-6.0.3/COPYING
redis-6.0.3/INSTALL
redis-6.0.3/MANIFESTO
redis-6.0.3/Makefile
redis-6.0.3/README.md
redis-6.0.3/TLS.md
redis-6.0.3/deps/
redis-6.0.3/deps/Makefile
redis-6.0.3/deps/README.md
redis-6.0.3/deps/hiredis/
redis-6.0.3/deps/hiredis/.gitignore
redis-6.0.3/deps/hiredis/.travis.yml

接着切换到redis-6.0.3 目录下去:

jishu@Jishu:~/redis$ ls
redis-6.0.3  redis-6.0.3.tar.gz
jishu@Jishu:~/redis$ cd redis-6.0.3
jishu@Jishu:~/redis/redis-6.0.3$ ls
00-RELEASENOTES  COPYING    Makefile   deps        runtest-cluster    sentinel.conf  utils
BUGS             INSTALL    README.md  redis.conf  runtest-moduleapi  src
CONTRIBUTING     MANIFESTO  TLS.md     runtest     runtest-sentinel   tests

2、进行编译安装

编译:

jishu@Jishu:~/redis/redis-6.0.3$ make


  CC geohash.o
    CC geohash_helper.o
    CC childinfo.o
    CC defrag.o
    CC siphash.o
    CC rax.o
    CC t_stream.o
    CC listpack.o
    CC localtime.o
    CC lolwut.o
    CC lolwut5.o
    CC lolwut6.o
    CC acl.o
    CC gopher.o
    CC tracking.o
    CC connection.o
    CC tls.o
    CC sha256.o
    CC timeout.o
    CC setcpuaffinity.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 '/home/jishu/redis/redis-6.0.3/src'

接着:

root@Jishu:/home/jishu/redis/redis-6.0.3# make install 
cd src && make install
make[1]: Entering directory '/home/jishu/redis/redis-6.0.3/src'
/bin/sh: 1: pkg-config: not found
    CC Makefile.dep
/bin/sh: 1: pkg-config: not found

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install

现在我们可以来查看一下redis的版本:

root@Jishu:/home/jishu/redis/redis-6.0.3# redis-server -v
Redis server v=6.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=83b46ee25cea98e3

3、启动redis

服务端:

root@Jishu:/home/jishu/redis/redis-6.0.3# redis-server
21603:C 11 Oct 2020 19:34:13.548 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
21603:C 11 Oct 2020 19:34:13.549 # Redis version=6.0.3, bits=64, commit=00000000, modified=0, pid=21603, just started
21603:C 11 Oct 2020 19:34:13.549 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
21603:M 11 Oct 2020 19:34:13.554 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 21603
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

21603:M 11 Oct 2020 19:34:13.556 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
21603:M 11 Oct 2020 19:34:13.556 # Server initialized
21603:M 11 Oct 2020 19:34:13.556 # 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.
21603:M 11 Oct 2020 19:34:13.557 * Ready to accept connections

客户端:

root@Jishu:/home/jishu/redis/redis-6.0.3# redis-cli
127.0.0.1:6379> 

注意:如果要暂停服务端的话,可以直接按ctrl+c或者客户端发送SHUTDOWN命令就行!

本期的内容先暂时分享到这里,下期的测试分享会设计到redis的命令和编程使用;今天的测试中发现镜像源好像换不了,换了阿里,清华、163源等国内镜像源都行不通,唯有开发板自带的华为的源可以更新并安装软件,这个原因暂时没有找到为啥?

推荐阅读
关注数
4278
内容数
71
低成本Arm微服务器开发平台“云芯1号”教程及应用,欢迎关注
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息