***まとめ:linuxでredisを接続し、コマンドライン操作を行う(redisパスワードの設定)

6471 ワード



[root@iZ254lfyd6nZ ~]# cd /

[root@iZ254lfyd6nZ /]# ls

bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  sbin  selinux  srv  sys  tmp  usr  var

[root@iZ254lfyd6nZ /]# cd usr

[root@iZ254lfyd6nZ usr]# ls

bin  etc  games  include  lib  lib64  libexec  local  sbin  share  src  tmp

[root@iZ254lfyd6nZ usr]# cd local

[root@iZ254lfyd6nZ local]# ls

aegis  bin  etc  games  include  lib  lib64  libexec  redis  redis-2.8.12.tar.gz  sbin  share  src

[root@iZ254lfyd6nZ local]# cd redis

[root@iZ254lfyd6nZ redis]# ls

00-RELEASENOTES  CONTRIBUTING  deps      INSTALL   MANIFESTO  redis.conf  runtest-sentinel  src    utils

BUGS             COPYING       dump.rdb  Makefile  README     runtest     sentinel.conf     tests

[root@iZ254lfyd6nZ redis]# cd src

[root@iZ254lfyd6nZ src]# ls

adlist.c     aof.o        db.o           intset.h      mkreleasehdr.sh  rand.c             redis-check-dump    replication.o   sha1.h          t_list.o      ziplist.o

adlist.h     asciilogo.h  debug.c        intset.o      multi.c          rand.h             redis-check-dump.c  rio.c           sha1.o          t_set.c       zipmap.c

adlist.o     bio.c        debug.o        lzf_c.c       multi.o          rand.o             redis-check-dump.o  rio.h           slowlog.c       t_set.o       zipmap.h

ae.c         bio.h        dict.c         lzf_c.o       networking.c     rdb.c              redis-cli           rio.o           slowlog.h       t_string.c    zipmap.o

ae_epoll.c   bio.o        dict.h         lzf_d.c       networking.o     rdb.h              redis-cli.c         scripting.c     slowlog.o       t_string.o    zmalloc.c

ae_evport.c  bitops.c     dict.o         lzf_d.o       notify.c         rdb.o              redis-cli.o         scripting.o     solarisfixes.h  t_zset.c      zmalloc.h

ae.h         bitops.o     endianconv.c   lzf.h         notify.o         redisassert.h      redis.h             sds.c           sort.c          t_zset.o      zmalloc.o

ae_kqueue.c  config.c     endianconv.h   lzfP.h        object.c         redis-benchmark    redis.o             sds.h           sort.o          util.c

ae.o         config.h     endianconv.o   Makefile      object.o         redis-benchmark.c  redis-sentinel      sds.o           syncio.c        util.h

ae_select.c  config.o     fmacros.h      Makefile.dep  pqsort.c         redis-benchmark.o  redis-server        sentinel.c      syncio.o        util.o

anet.c       crc64.c      help.h         memtest.c     pqsort.h         redis.c            release.c           sentinel.o      testhelp.h      valgrind.sup

anet.h       crc64.h      hyperloglog.c  memtest.o     pqsort.o         redis-check-aof    release.h           setproctitle.c  t_hash.c        version.h

anet.o       crc64.o      hyperloglog.o  migrate.c     pubsub.c         redis-check-aof.c  release.o           setproctitle.o  t_hash.o        ziplist.c

aof.c        db.c         intset.c       migrate.o     pubsub.o         redis-check-aof.o  replication.c       sha1.c          t_list.c        ziplist.h



[root@iZ254lfyd6nZ src]# ./redis-cli

127.0.0.1:6379> get name

"tanglei1234"

127.0.0.1:6379> config get requirepass

1) "requirepass"

2) ""

127.0.0.1:6379> config set requirepass newpsw

OK

127.0.0.1:6379> config get requirepass

(error) NOAUTH Authentication required.

127.0.0.1:6379> auth newpsw

OK

127.0.0.1:6379> get name

"tanglei1234"

127.0.0.1:6379> 

Connection closed by foreign host.