{"id":25955,"date":"2021-12-26T23:46:11","date_gmt":"2021-12-26T16:46:11","guid":{"rendered":"https:\/\/doc.bnix.vn\/?p=25955"},"modified":"2022-08-14T06:49:02","modified_gmt":"2022-08-13T23:49:02","slug":"huong-dan-cai-dat-va-cau-hinh-co-ban-redis-6-2-tren-directadmin","status":"publish","type":"post","link":"https:\/\/doc.bnix.vn\/huong-dan-cai-dat-va-cau-hinh-co-ban-redis-6-2-tren-directadmin\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t v\u00e0 c\u1ea5u h\u00ecnh c\u01a1 b\u1ea3n Redis 6.2 tr\u00ean Directadmin"},"content":{"rendered":"\n\n
\n \n
\n \n
\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n <\/div>\n \n
\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n <\/div>\n<\/div>\n \n\n
\n 4.6\/5 - (5 b\u00ecnh ch\u1ecdn) <\/div>\n <\/div>\n\r\n

Tr\u01b0\u1edbc khi h\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Redis 6, m\u00ecnh s\u1ebd \u0111i\u1ec3m qua t\u00ednh n\u0103ng \u01b0u vi\u1ec7t c\u1ee7a n\u00f3. \u1ede b\u1ea3n Redis 6 n\u00e0y c\u00f3 th\u1ec3 chia th\u00e0nh m\u1ed9t s\u1ed1 lo\u1ea1i kh\u00e1c nhau nh\u01b0 l\u00e0: B\u1ea3o m\u1eadt, hi\u1ec7u su\u1ea5t, d\u1ec5 s\u1eed d\u1ee5ng v\u00e0 th\u1eadm ch\u00ed m\u1ed9t s\u1ed1 ch\u1ee9c n\u0103ng ho\u00e0n to\u00e0n m\u1edbi nh\u01b0 l\u00e0:<\/p>\r\n

    \r\n
  • SSL<\/li>\r\n
  • ACL<\/li>\r\n
  • RESP3<\/li>\r\n
  • Client side caching: B\u1ed9 nh\u1edb \u0111\u1ec7m \u1edf m\u00e1y kh\u00e1ch<\/li>\r\n
  • Threaded I\/O<\/li>\r\n
  • H\u1ed7 tr\u1ee3 Cluster trong Redis-benchmark v\u00e0 c\u1ea3i ti\u1ebfn redis-cli cluster<\/li>\r\n
  • H\u1ed7 tr\u1ee3 nhi\u1ec1u module redis<\/li>\r\n
  • Redis Cluster Proxy<\/li>\r\n
  • RDB t\u1ef1 xo\u00e1 khi kh\u00f4ng c\u00f2n s\u1eed d\u1ee5ng<\/li>\r\n
  • Psync2 giao th\u1ee9c sao ch\u00e9p \u0111\u01b0\u1ee3c t\u1ed1i \u01b0u ho\u00e1<\/li>\r\n
  • H\u1ed7 tr\u1ee3 c\u00e0i \u0111\u1eb7t th\u1eddi gian ch\u1edd<\/li>\r\n
  • T\u1ea3i RDB nhanh h\u01a1n 20 \u2013 30%<\/li>\r\n<\/ul>\r\n

    M\u1eb7c \u0111\u1ecbnh khi c\u00e1c b\u1ea1n c\u00e0i Redis tr\u00ean Centos 7\/8 ho\u1eb7c Almalinux 8, th\u00ec b\u1ea3n redis c\u00e1c b\u1ea1n c\u00e0i theo h\u01b0\u1edbng d\u1eabn tr\u00ean google ch\u1ec9 l\u00e0 b\u1ea3n 5.x tr\u1edf xu\u1ed1ng m\u00e0 th\u00f4i. N\u00ean h\u00f4m nay m\u00ecnh chia s\u1ebb c\u00e1ch c\u00e0i \u0111\u1eb7t v\u00e0 c\u1ea5u h\u00ecnh c\u01a1 b\u1ea3n cho redis 6 tr\u00ean Directadmin.<\/p>\r\n\r\n\r\n\r\n

    \"\"<\/figure>\r\n\r\n\r\n\r\n

    Nh\u01b0ng tr\u01b0\u1edbc khi b\u01b0\u1edbc v\u00e0o vi\u1ec7c c\u00e0i \u0111\u1eb7t, m\u00ecnh xin c\u00f3 1 l\u01b0u \u00fd<\/p>\r\n\r\n\r\n\r\n

    \r\n

    N\u1ebeU B\u1ea0N KH\u00d4NG C\u00d3 PRO PACK<\/span> C\u1ee6A DIRECTADMIN VUI L\u00d2NG KH\u00d4NG K\u00cdCH HO\u1ea0T C\u00c1C TU\u1ef2 CH\u1eccN REDIS T\u1ea0I CUSTOMBUILD V\u00cc S\u1ebc G\u00c2Y XUNG \u0110\u1ed8T V\u1edaI REDIS \u0110\u01af\u1ee2C C\u00c0I \u0110\u1eb6T TRONG H\u1ec6 \u0110I\u1ec0U H\u00c0NH C\u1ee6A B\u00c0I VI\u1ebeT N\u00c0Y (K\u00cdCH HO\u1ea0T KH\u00d4NG \u0110\u01af\u1ee2C G\u00cc NH\u01afNG L\u1ea0I G\u00c2Y XUNG \u0110\u1ed8T). N\u1ebeU B\u1ea0N C\u00d3 PRO PACK XIN VUI L\u00d2NG K\u00cdCH HO\u1ea0T T\u00cdNH N\u0102NG REDIS T\u1ea0I CUSTOMBUILD V\u00c0 B\u1ece QUA B\u00c0I VI\u1ebeT N\u00c0Y.<\/em><\/strong><\/p>\r\n<\/blockquote>\r\n\r\n\r\n\r\n

    Ph\u1ea7n 1 – C\u00e0i \u0111\u1eb7t Redis 6<\/h2>\r\n\r\n\r\n\r\n

    Do Directadmin h\u1ed7 tr\u1ee3 nhi\u1ec1u phi\u00ean b\u1ea3n h\u1ec7 \u0111i\u1ec1u h\u00e0nh, v\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng nhi\u1ec1u nh\u1ea5t l\u00e0 Centos, n\u00ean h\u00f4m nay m\u00ecnh s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t ri\u00eang \u0111\u1ed1i v\u1edbi t\u1eebng h\u1ec7 \u0111i\u1ec1u h\u00e0nh, m\u00e0 c\u1ee5 th\u1ec3 l\u00e0 Centos 7 v\u00e0 Centos 8\/Almalinux 8<\/p>\r\n\r\n\r\n\r\n

    1. C\u00e0i \u0111\u1eb7t Redis 6 tr\u00ean Directadmin – Centos 7<\/h3>\r\n\r\n\r\n\r\n

    C\u1eadp nh\u1eadt Centos 7 l\u00ean phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t<\/h4>\r\n\r\n\r\n\r\n
    yum clean all;yum update -y;yum upgrade -y;yum autoremove -y<\/pre>\r\n\r\n\r\n\r\n

    C\u00e0i \u0111\u1eb7t Redis 6 tr\u00ean Centos 7<\/h4>\r\n\r\n\r\n\r\n
    yum -y install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm;\r\nyum --enablerepo=remi -y install redis<\/pre>\r\n\r\n\r\n\r\n

    2. C\u00e0i \u0111\u1eb7t Redis 6 tr\u00ean Directadmin – Centos 8\/Almalinux 8<\/h3>\r\n\r\n\r\n\r\n

    C\u1eadp nh\u1eadt Centos 8 \/ Almalinux 8 l\u00ean phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t<\/h4>\r\n\r\n\r\n\r\n
    dnf clean all;dnf update -y;dnf upgrade -y;dnf autoremove -y<\/pre>\r\n\r\n\r\n\r\n

    C\u00e0i \u0111\u1eb7t Redis 6 tr\u00ean Centos 8\/ Almalinux 8<\/h4>\r\n\r\n\r\n\r\n

    \u0110\u1ed1i v\u1edbi AlmaLinux 8, CentOS 8<\/strong>:\u00a0<\/strong>B\u1ea1n c\u1ea7n ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 n\u1ea1p Remi repo v\u00e0 t\u00ecm phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t c\u1ee7a Redis.<\/p>\r\n\r\n\r\n\r\n

    dnf install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm -y;\r\ndnf module list | grep redis<\/pre>\r\n\r\n\r\n\r\n

    Sau khi ch\u1ea1y c\u1eb7p l\u1ec7nh tr\u00ean b\u1ea1n s\u1ebd nh\u1eadn \u0111\u01b0\u1ee3c k\u1ebft qu\u1ea3 g\u1ea7n t\u01b0\u01a1ng t\u1ef1 nh\u01b0 sau:<\/p>\r\n\r\n\r\n\r\n

    redis     5 [d]        common [d]     Redis persistent key-value database                                        \r\nredis     remi-5.0     common [d]     Redis persistent key-value database                                         \r\nredis     remi-6.0     common [d]     Redis persistent key-value database                  \r\nredis     remi-6.2     common [d]     Redis persistent key-value database  <\/pre>\r\n\r\n\r\n\r\n

    Gi\u1ea3 s\u1eed phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t l\u00e0\u00a0remi-6.2<\/strong>, b\u1ea1n ch\u1ea1y c\u1eb7p l\u1ec7nh sau \u0111\u1ec3 ti\u1ebfn h\u00e0nh c\u00e0i.<\/p>\r\n\r\n\r\n\r\n

    dnf module reset redis -y;\r\ndnf module install redis:remi-6.2 -y;<\/pre>\r\n\r\n\r\n\r\n

    L\u01b0u \u00fd: C\u1ea7n ki\u1ec3m tra Redis ph\u1ea3i \u1edf version 6 \u0111\u1ed5 l\u00ean b\u1eb1ng l\u1ec7nh sau v\u00ec h\u01b0\u1edbng d\u1eabn c\u1ea5u h\u00ecnh ti\u1ebfp theo ch\u1ec9 \u00e1p d\u1ee5ng cho redis version 6 tr\u1edf l\u00ean:<\/em><\/strong><\/p>\r\n\r\n\r\n\r\n

    redis-cli -v<\/pre>\r\n\r\n\r\n\r\n

    3. C\u1ea5u h\u00ecnh Redis 6 tr\u00ean Directadmin<\/h3>\r\n\r\n\r\n\r\n

    \u1ede \u0111\u00e2y t\u00f4i s\u1ebd d\u00f9ng nano<\/strong>. C\u00e1c b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng vi<\/strong> ho\u1eb7c tr\u00ecnh ch\u1ec9nh s\u1eeda th\u00f4ng qua SFTP \u0111\u1ec3 ch\u1ec9nh s\u1eeda file\u00a0\/etc\/redis\/redis.conf<\/strong>: B\u1ea1n n\u00e0o ch\u01b0a c\u00f3 nano c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t th\u00eam b\u1eb1ng l\u1ec7nh yum -y install nano<\/code><\/p>\r\n\r\n\r\n\r\n

    nano \/etc\/redis\/redis.conf<\/pre>\r\n\r\n\r\n\r\n

    T\u1ea1i\u00a0redis.conf<\/strong>\u00a0c\u00f3 r\u1ea5t nhi\u1ec1u m\u1ee5c. Ch\u00fang ta ch\u1ec9 \u0111i\u1ec1u ch\u1ec9nh 1 s\u1ed1 m\u1ee5c sau:<\/p>\r\n\r\n\r\n\r\n

    tcp-keepalive 0 # Kh\u00f4ng h\u1ebft h\u1ea1n th\u1eddi gian k\u1ebft n\u1ed1i redis\r\nsupervised systemd # \u0110\u1ecbnh h\u00ecnh cho redis ch\u1ea1y tr\u00ean n\u1ec1n systemd\r\n# save 3600 1 # Th\u00eam # v\u00e0o \u0111\u1ea7u 3 d\u00f2ng \u0111\u1ec3 t\u1eaft t\u00ednh n\u0103ng ghi l\u00ean \u0111\u0129a c\u1ee7a redis\r\n# save 300 100 # Th\u00eam # v\u00e0o \u0111\u1ea7u 3 d\u00f2ng \u0111\u1ec3 t\u1eaft t\u00ednh n\u0103ng ghi l\u00ean \u0111\u0129a c\u1ee7a redis\r\n# save 60 10000 # Th\u00eam # v\u00e0o \u0111\u1ea7u 3 d\u00f2ng \u0111\u1ec3 t\u1eaft t\u00ednh n\u0103ng ghi l\u00ean \u0111\u0129a c\u1ee7a redis\r\nrdbcompression no # T\u1eaft n\u00e9n d\u1eef li\u1ec7u\r\nrdbchecksum no # T\u1eaft Checksum\r\nio-threads 8 # T\u0103ng s\u1ed1 ti\u1ebfn tr\u00ecnh redis s\u1ebd ch\u1ea1y. M\u1eb7c \u0111\u1ecbnh l\u00e0 4.<\/pre>\r\n\r\n\r\n\r\n

    4. Cho Redis kh\u1edfi \u0111\u1ed9ng c\u00f9ng h\u1ec7 th\u1ed1ng:<\/h3>\r\n\r\n\r\n\r\n
    systemctl enable redis<\/pre>\r\n\r\n\r\n\r\n

    5. Kh\u1edfi \u0111\u1ed9ng Redis:<\/h3>\r\n\r\n\r\n\r\n
    systemctl start redis<\/pre>\r\n\r\n\r\n\r\n

    Ph\u1ea7n 2 – C\u00e0i \u0111\u1eb7t phpRedis cho DriectAdmin<\/h2>\r\n\r\n\r\n\r\n

    \u0110\u1ec3 k\u1ebft n\u1ed1i \u0111\u01b0\u1ee3c Redis v\u1edbi website, ch\u00fang ta ph\u1ea3i c\u00e0i th\u00eam 1 extension n\u1eefa cho php, \u0111\u00f3 ch\u00ednh l\u00e0 phpRedis. Gi\u1edd m\u00ecnh ti\u1ebfn h\u00e0nh c\u00e0i \u0111\u1eb7t nh\u00e9.<\/p>\r\n\r\n\r\n\r\n

    1. B\u1eadt popen cho PHP:<\/h3>\r\n\r\n\r\n\r\n

    N\u1ebfu Directadmin c\u1ee7a b\u1ea1n t\u1eebng c\u00e0i \u0111\u1eb7t php_secure, h\u00e3y ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 x\u00f3a c\u1ea5u h\u00ecnh \u0111\u00f3 tr\u01b0\u1edbc<\/p>\r\n\r\n\r\n\r\n

    cd \/usr\/local\/directadmin\/custombuild\/;\r\nrm -f custom\/php_disable_functions;<\/pre>\r\n\r\n\r\n\r\n

    Ti\u1ebfp theo ta t\u1ea1o l\u1ea1i file c\u1ea5u h\u00ecnh (c\u00f3 b\u1eadt l\u1ea1i popen)<\/p>\r\n\r\n\r\n\r\n

    cd \/usr\/local\/directadmin\/custombuild;\r\necho \"exec,system,passthru,shell_exec,proc_close,proc_open,dl,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname\" > custom\/php_disable_functions;\r\n.\/build secure_php<\/pre>\r\n\r\n\r\n\r\n

    2. C\u00e0i phpRedis cho t\u1ea5t c\u1ea3 PHP c\u1ee7a DirectAdmin<\/h3>\r\n\r\n\r\n\r\n

    B\u1ea1n ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 c\u00e0i \u0111\u1eb7t phpRedis cho t\u1ea5t c\u1ea3 phi\u00ean b\u1ea3n php (l\u01b0u \u00fd c\u00f3 reboot server):<\/p>\r\n\r\n\r\n\r\n

    cd \/usr\/local\/directadmin\/scripts\/custom;\r\nwget https:\/\/raw.githubusercontent.com\/poralix\/directadmin-utils\/master\/php\/php-extension.sh -O php-extension.sh;\r\nchmod 750 php-extension.sh;\r\n.\/php-extension.sh install redis;\r\nsystemctl reboot;<\/pre>\r\n\r\n\r\n\r\n

    Ch\u00fac c\u00e1c b\u1ea1n c\u00e0i \u0111\u1eb7t Redis 6 tr\u00ean Directadmin th\u00e0nh c\u00f4ng nh\u00e9!<\/p>\r\n","protected":false},"excerpt":{"rendered":"

    Tr\u01b0\u1edbc khi h\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t Redis 6, m\u00ecnh s\u1ebd \u0111i\u1ec3m qua t\u00ednh n\u0103ng \u01b0u…<\/p>\n","protected":false},"author":3,"featured_media":25956,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[195],"tags":[203,204,202],"class_list":["post-25955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cai-dat-vps-directadmin","tag-redis","tag-redis-6","tag-redis-cache"],"_links":{"self":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts\/25955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/comments?post=25955"}],"version-history":[{"count":0,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts\/25955\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/media\/25956"}],"wp:attachment":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/media?parent=25955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/categories?post=25955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/tags?post=25955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}