在mac上通过Homebrew安装redis

上一篇 / 下一篇  2017-11-13 16:54:00 / 个人分类:相关工具

使用Homebrew安装redis可以减少大量的安装和配置的工作量。
安装命令

brew install redis


  ~ brew install redis
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
csvkit                               e2tools                              just                                 simg2img
dps8m                                heartbeat                            kaitai-struct-compiler
==> Updated Formulae
imagemagick
                 faas-cli                      jenkins-lts                   node                          rtags
abcmidi                       feh                           jruby                         node-build                    scalaenv
alexjs                        ffmpeg@2.8                    kerl                          node@4                        scalastyle
amazon-ecs-cli                filebeat                      kibana                        node@6                        scm-manager
apibuilder-cli                firebase-cli                  knot-resolver                 ntl                           selenium-server-standalone
app-engine-java               flow                          kobalt                        nuttcp                        simple-obfs
aria2                         fluent-bit                    kubectx                       omniorb                       singular
asciidoc                      fn                            kubernetes-cli                ompl                          sjk
b2-tools                      frugal                        ldc                           openvdb                       solr
babl                          gdcm                          libcue                        ortp                          source-to-image
bash-snippets                 gegl                          libfabric                     packetbeat                    sourcekitten
bazel                         getdns                        libfixbuf                     packetq                       ssdeep
binaryen                      geth                          libgsf                        paket                         sslyze
bit                           git-annex                     libmaxminddb                  pandoc                        svgo
bluepill                      glide                         libogg                        pandoc-crossref               swiftformat
buku                          gmic                          libpq                         pcl                           swiftlint
certigo                       gmt                           libpqxx                       pdfcrack                      syncthing
charm-tools                   gmt@4                         libuv                         pick                          telegraf
chisel                        gnu-time                      logstash                      pipenv                        temporal_tables
cimg                          gnupg                         logtalk                       poco                          terragrunt
clojure                       go-jira                       mdds                          poppler                       tintin
cmake                         gofabric8                     metricbeat                    postgresql                    typescript
convox                        gradle                        mikutter                      postgresql@9.4                uncrustify
couchdb                       grpc                          mingw-w64                     postgresql@9.5                vala
cppad                         gsmartcontrol                 mitie                         postgresql@9.6                vapoursynth
davix                         gtk+3                         monit                         pre-commit                    vtk
debianutils                   hadoop                        mupdf                         prometheus                    wireguard-tools
django-completion             hashcat                       mupdf-tools                   protobuf-swift                xmake
docfx                         hive                          mypy                          pushpin                       yara
docker-compose                i2p                           nanomsg                       py2cairo                      zabbix
docker-compose-completion     imagemagick@6                 nativefier                    py3cairo                      zint
doitlive                      immortal                      nco                           rabbitmq                      zurl
dssim                         influxdb                      ncview                        rbenv-bundler
elasticsearch                 inspircd                      neovim                        re2c
erlang                        iron-functions                netcdf                        resty
exploitdb                     jenkins                       nickle                        ringojs
==> Renamed Formulae
newsbeuter -> newsboat
==> Deleted Formulae
bchunk

==> Downloading https://homebrew.bintray.com/bottles/redis-4.0.2.sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring redis-4.0.2.sierra.bottle.1.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  redis-server /usr/local/etc/redis.conf
==> Summary
🍺  /usr/local/Cellar/redis/4.0.2: 13 files, 2.8MB

  ~ pwd
/Users/mac

  ~ cd /usr/local/Cellar/redis/4.0.2/bin
  bin ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli       redis-sentinel  redis-server
  bin ./redis-cli -h ceshi.my.com -p 6378 -a 密码

^C
  bin ./redis-cli -h ceshi.my.com -p 6379 -a 密码
ceshi.my.com:6379>select 1
OK
ceshi.my.com:6379[1]> key reg_*
(error) ERR unknown command 'key'
ceshi.my.com:6379[1]>keys reg_*
1) "reg_18515108600"
2) "reg_18629081280"
3) "reg_13620171113"
4) "reg_13311111111"
5) "reg_13232323232"
ceshi.my.com:6379[1]> get reg_reg_18515108600
(nil)
ceshi.my.com:6379[1]> get reg_18515108600
"877635"
ceshi.my.com:6379[1]>
  bin pwd
/usr/local/Cellar/redis/4.0.2/bin
  bin./redis-cli -h ceshi.my.com -p 6379 -a password
ceshi.my.com:6379> keys *
'1) "PHP_java_api_sum"
2) "PHP_Admin_Nav"
3) "PHP_Admin_Node_All"
4) "PHP_categorylist_level"
5) "PHP_rbac_shop_redis_list"
6) "PHP_java_api_method_sum"
ceshi.my:6379> select 1
OK
ceshi.my.com:6379[1]> keys  *
   1) "3FED2D01D8A12A8AD4D3F350021DD47215058012181411198238304"
   2) "AE3E6F82854148CF32748D18E80ADE2D20170907164715876"
   3) "1090618090000000000"
   4) "after_sale_flow_status_111061508228501275_1"
   5) "AB704CCAD89A6917BA6D9AAD278BEEE315088370708211667596991"
   6) "5FFE8167AE474DEBF5892639EC2238A715054574645237655558901"
   7) "F71C1624C3CA1F23F5994C93C571572515084969572546594824039"
   8) "1080312030300000000"
   9) "1090424060000000000"


要在Redis远程服务器上运行命令,需要通过客户端redis-cli连接到服务器

语法

[yiibai@ubuntu:~]$ redis-cli -h host -p port -a password

示例
以下示例显示如何连接到Redis远程服务器,在主机(host)127.0.0.1,端口(port)6379上运行,并使用密码为mypass

[yiibai@ubuntu:~]$ redis-cli -h 127.0.0.1 -p 6379 -a "mypass" 
redis 127.0.0.1:6379> 
redis 127.0.0.1:6379> PING  
PONG


 


TAG:

 

评分:0

我来说两句

Open Toolbar