linux用redis数据库,linux下安装redis数据库

Redis 下载地址

我下载的是2.8

在linux下载

下载完成后 解压文件

然后进入 redis-2.8.24 文件夹下   cd redis-2.8.24

使用命令  make 编译一下

然后 进入到redis 的src目录下

cd ./src

使用 make install

现在已经安装完毕

(下面的不是必要的)

在常用软件安装目录下创建一个文件夹  redis并在redis下创建bin文件夹以及etc文件夹

把redis-2.8.24/src 文件夹下的命令移动到  redis/bin 目录下

把redis-2.8.24目录下的redis.conf 文件移动到redis/ect目录下

启动redis

使用redis-server命令

[root@iZ28fyf89jaZ ~]# /usr/java/redis/bin/redis-server

[996] 05 May 08:50:13.862 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/java/redis/bin/redis-server /path/to/redis.conf

_._

_.-``__ ''-._

_.-``    `.  `_.  ''-._           Redis 2.8.24 (00000000/0) 64 bit

.-`` .-```.  ```\/    _.,_ ''-._

(    '      ,       .-`  | `,    )     Running in stand alone mode

|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

|    `-._   `._    /     _.-'    |     PID: 996

`-._    `-._  `-./  _.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |           http://redis.io

`-._    `-._`-.__.-'_.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |

`-._    `-._`-.__.-'_.-'    _.-'

`-._    `-.__.-'    _.-'

`-._        _.-'

`-.__.-'

[996] 05 May 08:50:13.867 # Server started, Redis version 2.8.24

[996] 05 May 08:50:13.867 # 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.

[996] 05 May 08:50:13.867 # 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.

[996] 05 May 08:50:13.867 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

[996] 05 May 08:50:13.881 * DB loaded from disk: 0.014 seconds

[996] 05 May 08:50:13.881 * The server is now ready to accept connections on port 6379

这样就启动了 redis   标红色是警告   原因是没有指定配置文件   这样启动会占用当前会话

[root@iZ28fyf89jaZ ~]# /usr/java/redis/bin/redis-server /usr/java/redis/etc/redis.conf

_._

_.-``__ ''-._

_.-``    `.  `_.  ''-._           Redis 2.8.24 (00000000/0) 64 bit

.-`` .-```.  ```\/    _.,_ ''-._

(    '      ,       .-`  | `,    )     Running in stand alone mode

|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

|    `-._   `._    /     _.-'    |     PID: 1148

`-._    `-._  `-./  _.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |           http://redis.io

`-._    `-._`-.__.-'_.-'    _.-'

|`-._`-._    `-.__.-'    _.-'_.-'|

|    `-._`-._        _.-'_.-'    |

`-._    `-._`-.__.-'_.-'    _.-'

`-._    `-.__.-'    _.-'

`-._        _.-'

`-.__.-'

[1148] 05 May 08:56:14.599 # Server started, Redis version 2.8.24

[1148] 05 May 08:56:14.599 # 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.

[1148] 05 May 08:56:14.599 # 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.

[1148] 05 May 08:56:14.599 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

[1148] 05 May 08:56:14.599 * DB loaded from disk: 0.000 seconds

[1148] 05 May 08:56:14.599 * The server is now ready to accept connections on port 6379

指定配置文件后警告就没有了  但是还是占用了当前的会话   解决办法  修改redis.conf文件

文件中第一个配置是:

daemonize no

# 这一项是配置redis可以后台运行 默认为no 想要设置成后台启动设置为 yes

再次启动redis  就不会占用当前会话    然后使ps -ef|grep redis 命令来验证是否启动成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值