Ubuntu下搭建Redis服务器

野性酷女 2022-06-08 07:14 304阅读 0赞

在Ubuntu中搭建Redis服务器

安装

1 安装

  1. sudo apt-get install redis-server

2 启动

  1. redis-server
  2. 5617:C 18 Sep 12:57:10.437 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
  3. 5617:M 18 Sep 12:57:10.437 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.6 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 5617 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 5617:M 18 Sep 12:57:10.438 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 5617:M 18 Sep 12:57:10.438 # Server started, Redis version 3.0.6 5617:M 18 Sep 12:57:10.438 # 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. 5617:M 18 Sep 12:57:10.438 # 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. 5617:M 18 Sep 12:57:10.438 * DB loaded from disk: 0.000 seconds 5617:M 18 Sep 12:57:10.438 * The server is now ready to accept connections on port 6379

3 启动客户端

  1. redis-cli
  2. 127.0.0.1:6379> ping
  3. PONG

4 检查 Redis 服务器系统进程

  1. ps -aux|grep redis
  2. ubuntu 5617 0.0 0.7 38856 7884 pts/0 Sl+ 12:57 0:01 redis-server *:6379
  3. ubuntu 5707 0.0 0.0 12944 976 pts/1 S+ 13:22 0:00 grep redis

5 通过端口检查 Redis 服务器状态

  1. netstat -nlt|grep 6379
  2. tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
  3. tcp6 0 0 :::6379 :::* LISTEN

6 通过启动命令检查 Redis 服务器状态

  1. sudo /etc/init.d/redis-server status
  2. redis-server is running

配置

1 设置登录密码

  1. # 取消注释requirepass
  2. requirepass your_password

2 取消登录IP限制

  1. # 注释bind
  2. # bind 127.0.0.1

发表评论

表情:
评论列表 (有 0 条评论,304人围观)

还没有评论,来说两句吧...

相关阅读

    相关 UbuntuFTP服务器

     后台一直提示wordperss版本和插件有更新,看着碍眼,决定把它们全都更新。不过更新文件需要服务器提供FTP服务, [linode][]也没有提供到FTP,只能自己装

    相关 ubuntuNTP服务器

    由于公司架构需求部分服务器走内部网络,这部分服务器均无外部网络,导致存在一个问题就是时间无法进行同步,于是网上找了下资料可以通过搭建ntp服务器来解决这问题,也相对简单,废话少