fjqzyc 发表于 2018-11-6 09:50:40

redis部署手册

a)配置redis环境变量  
# exportPATH=/application/redis/bin/:$PATH
  
#   该行只是临时生效redis命令的环境变量
  
#redis-server      #   在命令行下测试该命令,如果能tab键出来,表示为成功;
  
# echo"PATH=/application/redis/bin/:$PATH" >>/etc/profile
  
# 写入到配置文件,使其永久生效
  
# tail -1/etc/profile   #   查看是否添加正确
  
PATH=/application/redis/bin/:/application/redis/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
  
# ./etc/profile      #   执行后,使配置立即生效
  
# whichredis-server #查看是否有redis-server命令及位置
  
/application/redis/bin/redis-server
  
b)查看命令帮助
  
# redis-server--help
  
Usage: ./redis-server
  
       ./redis-server - (read config fromstdin)
  
       ./redis-server -v or --version
  
       ./redis-server -h or --help
  
       ./redis-server --test-memory
  

  
Examples:
  
       ./redis-server (run the server withdefault conf)
  
       ./redis-server /etc/redis/6379.conf
  
       ./redis-server --port 7777
  
       ./redis-server --port 7777 --slaveof127.0.0.1 8888
  
       ./redis-server /etc/myredis.conf--loglevel verbose
  

  
Sentinel mode:
  
       ./redis-server /etc/sentinel.conf--sentinel
  
c)启动redis服务
  
# mkdir/application/redis/conf
  
# 1)创建redis的配置文件目录
  
# cp/application/tools/redis-2.8.9/redis.conf /application/redis/conf/
  
# 2) 拷贝源码包目录下的redis.conf文件
  
# sysctlvm.overcommit_memory=1
  
# 3) 执行sysctl命令,分配内存大小
  
vm.overcommit_memory = 1
  
# redis-server/application/redis/conf/redis.conf &    # 启动服务
  
15623
  
# 04 Jun20:35:02.093 * Increased maximum number of open files to 10032 (it wasoriginally set to 1024).
  
                _._
  
         _.-``__ ''-._
  
      _.-``   `.`_.''-._         Redis 2.8.9 (00000000/0) 64 bit
  
.-`` .-```. ```\/    _.,_ ''-._
  
(   '      ,       .-` | `,    )   Running in stand alone mode
  
|`-._`-...-` __...-.``-._|'` _.-'|   Port: 6379
  
|   `-._   `._    /    _.-'    |   PID: 15623
  
`-._   `-._`-./_.-'   _.-'
  
|`-._`-._   `-.__.-'    _.-'_.-'|
  
|   `-._`-._      _.-'_.-'    |          http://redis.io
  
`-._   `-._`-.__.-'_.-'    _.-'
  
|`-._`-._   `-.__.-'    _.-'_.-'|
  
|   `-._`-._      _.-'_.-'    |
  
`-._   `-._`-.__.-'_.-'    _.-'
  
      `-._   `-.__.-'    _.-'
  
          `-._      _.-'
  
            `-.__.-'
  

  
04 Jun 20:35:02.097 #Server started, Redis version 2.8.9
  
04 Jun 20:35:02.097 *The server is now ready to accept connections on port 6379
  
# lsof-i:6379#查看redis是否启动
  
COMMAND   PID USERFD   TYPE DEVICE SIZE/OFF NODENAME
  
redis-ser 15623 root    4u IPv631395      0t0 TCP *:6379 (LISTEN)
  
redis-ser 15623 root    5u IPv431397      0t0TCP*:6379 (LISTEN)


页: [1]
查看完整版本: redis部署手册