node.js学习(四、redis安装)

[root@iZ94b9jaqbfZ usr]# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
[root@iZ94b9jaqbfZ usr]# tar xzf redis-3.2.8.tar.gz
[root@iZ94b9jaqbfZ usr]# ln -s redis-3.2.8 redis
[root@iZ94b9jaqbfZ usr]# cd redis
[root@iZ94b9jaqbfZ redis]# make PREFIX=/usr/local/redis install

make[1]: Leaving directory `/usr/redis-3.2.8/src’
[root@iZ94b9jaqbfZ redis]# cd /usr/redis-3.2.8/src
[root@iZ94b9jaqbfZ redis]# ls

//若编译成功该文件夹下应有很多文件,包括reids-server redis-cli
//启动redis
[root@iZ94b9jaqbfZ src]# service redis start
Starting redis-server: [ OK ]

//运行redis客户端,进一步验证启动成功
[root@iZ94b9jaqbfZ src]# ./redis-cli
127.0.0.1:6379>

//配置redis
[root@iZ94b9jaqbfZ redis-3.2.8]# cd /usr/redis-3.2.8
[root@iZ94b9jaqbfZ redis-3.2.8]# ls
00-RELEASENOTES CONTRIBUTING deps Makefile README.md runtest runtest-sentinel src utils
BUGS COPYING INSTALL MANIFESTO redis.conf runtest-cluster sentinel.conf tests
[root@iZ94b9jaqbfZ redis-3.2.8]# cp redis.conf src
[root@iZ94b9jaqbfZ redis-3.2.8]# cd src
[root@iZ94b9jaqbfZ src]# ls
adlist.c blocked.c endianconv.c lzfP.h quicklist.o redis-sentinel server.o t_list.o
adlist.h blocked.o endianconv.h Makefile rand.c redis-server setproctitle.c t_set.c
adlist.o cluster.c endianconv.o Makefile.dep rand.h redis-trib.rb setproctitle.o t_set.o
ae.c cluster.h fmacros.h memtest.c rand.o release.c sha1.c t_string.c
ae_epoll.c cluster.o geo.c memtest.o rdb.c release.h sha1.h t_string.o
ae_evport.c config.c geo.h mkreleasehdr.sh rdb.h release.o sha1.o t_zset.c
ae.h config.h geo.o multi.c rdb.o replication.c slowlog.c t_zset.o
ae_kqueue.c config.o help.h multi.o redisassert.h replication.o slowlog.h util.c
ae.o crc16.c hyperloglog.c networking.c redis-benchmark rio.c slowlog.o util.h
ae_select.c crc16.o hyperloglog.o networking.o redis-benchmark.c rio.h solarisfixes.h util.o
anet.c crc64.c intset.c notify.c redis-benchmark.o rio.o sort.c valgrind.sup
anet.h crc64.h intset.h notify.o redis-check-aof scripting.c sort.o version.h
anet.o crc64.o intset.o object.c redis-check-aof.c scripting.o sparkline.c ziplist.c
aof.c db.c latency.c object.o redis-check-aof.o sdsalloc.h sparkline.h ziplist.h
aof.o db.o latency.h pqsort.c redis-check-rdb sds.c sparkline.o ziplist.o
asciilogo.h debug.c latency.o pqsort.h redis-check-rdb.c sds.h syncio.c zipmap.c
bio.c debugmacro.h lzf_c.c pqsort.o redis-check-rdb.o sds.o syncio.o zipmap.h
bio.h debug.o lzf_c.o pubsub.c redis-cli sentinel.c testhelp.h zipmap.o
bio.o dict.c lzf_d.c pubsub.o redis-cli.c sentinel.o t_hash.c zmalloc.c
bitops.c dict.h lzf_d.o quicklist.c redis-cli.o server.c t_hash.o zmalloc.h
bitops.o dict.o lzf.h quicklist.h redis.conf server.h t_list.c zmalloc.o
[root@iZ94b9jaqbfZ src]# vi redis.conf

//找到requirepass foobarod
# requirepass foobarod
去掉# 修改foobarodwei为自己的密码

:wq保存
//重启redis
[root@iZ94b9jaqbfZ src]# redis-cli -h 127.0.0.1 -p 6379 shutdown
[root@iZ94b9jaqbfZ src]# ./redis-server redis.conf
.
_.-__ ''-._
_.-
.. ”-. Redis 3.2.8 (00000000/0) 64 bit
.-.-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.
-._|’_.-'| Port: 6379
|
-._ ._ / _.-' | PID: 1951
-._ -._-./ .-’ .-’
|-._-._ -.__.-' _.-'_.-'|
|
-._-._ _.-'_.-' | http://redis.io
-._ -._-._.-‘.-’ _.-’
|-._-._ -.__.-' _.-'_.-'|
|
-._-._ _.-'_.-' |
-._ -._-._.-‘.-’ _.-’
-._-._.-’ .-’
-._ _.-'
-.__.-’

1951:M 13 Mar 17:40:20.639 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1951:M 13 Mar 17:40:20.639 # Server started, Redis version 3.2.8
1951:M 13 Mar 17:40:20.639 # 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.
1951:M 13 Mar 17:40:20.639 * The server is now ready to accept connections on port 6379

//但是这种启动方式在按ctrl+C时redis也会停止
//故需通过以下方式启动redis
[root@iZ94b9jaqbfZ src]# vi redis.conf

//找到daemonize no
daemonize yes

:wq保存
//重启redis
[root@iZ94b9jaqbfZ src]# redis-cli -h 127.0.0.1 -p 6379 shutdown
[root@iZ94b9jaqbfZ src]# ./redis-server redis.conf

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值