zoukankan      html  css  js  c++  java
  • mac os x install redis-3.2.9

    下载、解压、重命名并且编译安装Redis
    ~ wget http://download.redis.io/releases/redis-3.2.9.tar.gz
    ~ tar xzf redis-3.2.9.tar.gz
    ~ mv redis-3.2.9 redis
    ~ cd redis
    ~ make
    ~ make test
    ~ make install
    配置文件redis.conf
    redis解压目录里有一个配置文件redis.conf ,编辑此配置文件,找到 dir ./ 这一行[247行]。redis会将内存中的数据写入文件中,而此配置就是指定数据文件保存的路径。
    我本机指定的目录:
    dir ./
    修改为
    dir /Users/houxiurong/Software/redis_data/
    编辑过后,将配置文件移动到 /usr/local/etc 目录下
    ~ sudo mv redis.conf /usr/local/etc/
    启动Redis
    终端输入:
    ~ /usr/local/bin/redis-server /usr/local/etc/redis.conf
    服务启动成功画面:
    houxiurong-MacBook-Pro:src houxiurong$ /usr/local/bin/redis-server /usr/local/etc/redis.conf
    6508:M 01 Jul 18:21:33.662 * Increased maximum number of open files to 10032 (it was originally set to 256).
    _._
    _.-``__ ''-._
    _.-`` `. `_. ''-._ Redis 3.2.9 (00000000/0) 64 bit
    .-`` .-```. ```/ _.,_ ''-._
    ( ' , .-` | `, ) Running in standalone mode
    |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
    | `-._ `._ / _.-' | PID: 6508
    `-._ `-._ `-./ _.-' _.-'
    |`-._`-._ `-.__.-' _.-'_.-'|
    | `-._`-._ _.-'_.-' | http://redis.io
    `-._ `-._`-.__.-'_.-' _.-'
    |`-._`-._ `-.__.-' _.-'_.-'|
    | `-._`-._ _.-'_.-' |
    `-._ `-._`-.__.-'_.-' _.-'
    `-._ `-.__.-' _.-'
    `-._ _.-'
    `-.__.-'

    6508:M 01 Jul 18:21:33.664 # Server started, Redis version 3.2.9
    6508:M 01 Jul 18:21:33.664 * DB loaded from disk: 0.000 seconds
    6508:M 01 Jul 18:21:33.664 * The server is now ready to accept connections on port 6379

    测试连通性
    ~ cd /usr/local/bin
    ~ ./redis-cli
    127.0.0.1:6379> set me houxiurong
    OK
    127.0.0.1:6379> get me
    "houxiurong"
    设置开机自动启动redis server
    新建plist文件
    ~ sudo vi /Library/LaunchDaemons/io.redis.redis-server.plist
    文件内容如下
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>io.redis.redis-server</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/bin/redis-server</string>
    <string>/usr/local/etc/redis.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>
    使用launchctl设置开机自动启动
    ~ sudo launchctl load /Library/LaunchDaemons/io.redis.redis-server.plist
    使用launchctl启动redis server
    ~ sudo launchctl start io.redis.redis-server
    使用launchctl停止redis server
    ~ sudo launchctl stop io.redis.redis-server

  • 相关阅读:
    parted命令
    parted命令
    Dell R410 上安裝 Debian6
    vmware虚拟机桥接方式ping不通问题解决
    SNMP的应用
    五种方法安装Windows 7 64位系统
    Win7 文件共享
    重装或克隆虚拟机后——eth0改变
    udev 高效、动态地管理 Linux 设备文件
    Configuring raw devices (multipath) for Oracle Clusterware 10g Release 2 (10.2.0) on RHEL5OEL5
  • 原文地址:https://www.cnblogs.com/xrhou12326/p/7103106.html
Copyright © 2011-2022 走看看