Guest User

Untitled

a guest
Jul 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. ## FOR MULTIPLE REDIS INSTANCE INSTALLATION ON RHEL7+ USE THE FOLLOWING PATHS AND SETUP PROCESS:
  2. * create a new redis .conf file
  3.  
  4. ```Bash
  5. $ cp /etc/redis.conf /etc/redis-xxx.conf
  6. ```
  7.  
  8. * edit /etc/redis-xxx.conf, illustrated as below
  9.  
  10. ```Bash
  11. ...
  12. #modify pidfile
  13. #pidfile /var/run/redis/redis.pid
  14. pidfile /var/run/redis/redis-xxx.pid
  15.  
  16. ...
  17. #dir /var/lib/redis/
  18. dir /var/lib/redis-xxx/
  19.  
  20. ...
  21. #modify port
  22. #port 6379
  23. port 6380
  24.  
  25. ...
  26. #modify logfile
  27. #logfile /var/log/redis/redis.log
  28. logfile /var/log/redis/redis-xxx.log
  29.  
  30. ...
  31. #modify vm-swap-file
  32. #vm-swap-file /tmp/redis.swap
  33. vm-swap-file /tmp/redis-xxx.swap
  34. ...
  35. ```
  36. * make dir /var/lib/redis-xxx
  37.  
  38. ```Bash
  39. $ mkdir -p /var/lib/redis-xxx
  40. ```
  41.  
  42. * THERE IS NO init.d files RHEL uses systemctl instead so:
  43. * copy existing service over to your new service
  44.  
  45. ```Bash
  46. $ cp /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis-xxx.service
  47. ```
  48.  
  49. * modify your new service script to the following: (just change the redis-xxx path)
  50.  
  51. ```Bash
  52. ...
  53.  
  54. #[Unit]
  55. Description=Redis persistent key-value database
  56. After=network.target
  57.  
  58. #[Service]
  59. ExecStart=/usr/bin/redis-server /etc/redis-xxx.conf --daemonize no
  60. ExecStop=/usr/bin/redis-shutdown
  61. User=redis
  62. Group=redis
  63.  
  64. #[Install]
  65. WantedBy=multi-user.target
  66. ...
  67. ```
  68.  
  69. * if you have sentinel enabled on your system you will need to: (otherwise skip this step)
  70.  
  71. ```Bash
  72. # Copy values from cat /usr/lib/systemd/system/redis.service to /usr/lib/systemd/system/redis-xxx.service
  73. $ cp /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis-xxx.service
  74. ```
  75.  
  76. * then edit the contents of /usr/lib/systemd/system/redis-xxx.service (just change the /etc/redis-xxx path again)
  77.  
  78.  
  79. * start the new services:
  80.  
  81. ```Bash
  82. $ service redis-xxx start
  83. ```
  84.  
  85. * check the new services status:
  86.  
  87. ```Bash
  88. $ service redis-xxx status
  89. ```
  90.  
  91.  
  92. * stop the new services status:
  93.  
  94. ```Bash
  95. $ service redis-xxx stop
  96. ```
  97.  
  98.  
  99. * restart the new services status:
  100.  
  101. ```Bash
  102. $ service redis-xxx restart
  103. ```
  104.  
  105. * if you get some problems with service not found:
  106. * you can do the following:
  107. ```Bash
  108. $ systemctl unmask packagekit.service
  109. $ systemctl mask packagekit.service
  110. ```
  111. * then try to start the service again
Add Comment
Please, Sign In to add comment