Alibaba Cloud Redis Accelerates Access to the Discuz Forum

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介: Are you suffering from slow website access? Are you worried about overloading your servers by having too many visitors?

Galera_to_be_phased_out_MySQL_Group_Replication_officially_launched

Are you suffering from slow website access? Are you worried about overloading your servers by having too many visitors? Worry not. Alibaba Cloud ApsaraDB for Redis can provide the necessary solutions to your problems. Despite its computing power, Alibaba Cloud ECS has only 1 GB of memory. ECS is a high-performance server that is ideal for computing, but not necessarily ideal for database applications.

ApsaraDB for Redis supports both subscription and pay-as-you-go billing methods. If you are planning on using the database for a longer time, subscription is the way to go. You can get ApsaraDB for Redis from as low as $99 a month (China regions), or try it for free with our $300 New User Credit. Visit the official page of ApsaraDB for Redis for more information.

Alibaba Cloud ApsaraDB Redis

As an open source key-value type database cache and storage system, Redis provides extensive data structures to support diversified business chain scenarios, such as hashes, lists, sets, and ordered sets. ApsaraDB for Redis provides database services compatible with the Redis protocol, and supports single server mode and cluster mode. It offers a full range of database solutions including disaster tolerance, failover, online expansion, and performance optimization.

1

For new users, you can get $250 Free Credit to enjoy ApsaraDB for Redis services.

To test Redis, you can run the following code:

1. telnet r-m5e4873fd882de14.redis.rds.aliyuncs.com 6379 #Redis console connection
2. Trying 100.115.118.42...
3. Connected to r-m5e4873fd882de14.redis.rds.aliyuncs.com.
4. Escape character is '^]'.
5. auth password #Enter the password of the Redis console
6. +OK
7. quit
8. +OK
9. Connection closed by foreign host.

Installing PHP Extension

You can install the PHP extension for interfacing with Redis.

Install phpredis

1. wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz #Download
2. tar -zxvf nginx-2.2.4.tar.gz #Unzip the package
3. cd phpredis-2.2.4 #Enter the installation directory
4. /usr/local/php/bin/phpize #Use phpize to generate the configure files
5. ./configure --with-php-config=/usr/local/php/bin/php-config #Configure
6. make #Compile
7. make install #Install

The following installation path appears after the installation is completed /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

Configure php support

1. vi /usr/local/php/lib/php.ini #Edit the configuration file, and add the following contents into the last row (enter G: the cursor moves to the last row)
2. extension="redis.so"

Configure Session Management

Modify the session storage method, the default PHP uses a file to store the session information, which is saved in the tmp folder in Linux. Restart the PHP service, and the resulting PHP session information will be stored on Alibaba Cloud Redis. Users can resize Redis at any time based on fluctuations in business volume.

1. session.save_handler = redis
2. session.save_path = "tcp://host:6379?auth=PASSWORD"#Change to the host and password of the console

Save and quit.

1. :wq! #Save and quit

View the location of php.in

Please note that you should confirm the location of the php.in file yourself, as different operating systems and installation methods may place it in different locations
Edit the php file:

<?php phpinfo();?>

2

Restart php-fpm

Discuz Cache Configuration

Finally, we will see how we can speed up access to Discuz with ApsaraDB for Redish. Enabling the memory optimization function will greatly improve the performance of the program and the load capacity of the server. The memory optimization function needs support from the server system and the PHP extension module.

Memory optimization interfaces supported by Discuz are Memcache, eAccelerator, Alternative PHP Cache(APC), Xcache, Redis, YAC, and APCu. The optimization system will choose the best interface based on the current server environment.

Open the config_global.php file under the config directory

1. // -------------------  CONFIG MEMORY  --------------- //
2. $_config['memory']['prefix'] = 'RxwzUf_';
3. $_config['memory']['redis']['server'] = 'Enter the address connecting to the Redis console (host)';
4. $_config['memory']['redis']['port'] = 6379;
5. $_config['memory']['redis']['pconnect'] = 1;
6. $_config['memory']['redis']['timeout'] = '0';
7. $_config['memory']['redis']['requirepass'] = 'Enter the password of the Redis console';
8. $_config['memory']['redis']['serializer'] = 1;

Log on to the backend, and go to Global - Performance Optimization - Memory Optimization, and you will see the following interface (my interface is in Chinese):

3

Check the backend after it has been running for a while:

4

Summary

Advantages of Alibaba Cloud Redis

• Redis Master/Slave supports hot standby by default.
• Redis Master/Slave is a versatile configuration that supports lua, transaction, as well as Redis 3.0 GEO computing.
• Redis features excellent performance, boasting up to 10WQPS.
• Redis Master/Slave supports data persistence, one AOF Fsync per second, as well as backup and recovery features.
• Redis Master/Slave only has 256 MB memory but performs extremely well. The cost to performance ratio is very low for applications that require small amounts of memory.
• Redis Master/Slave supports dynamic resizing. Users can dynamically upgrade Redis to support business growth.
• Visualized historical monitoring data and alert configuration.
• Customized background backup cycle, keeps data for 7 days.

Disadvantages of Alibaba Cloud Redis

• Using Redis can be a little costly. This, however, is common among all cloud service providers.
• Initially, I had some issues configuring the IP whitelist (not sure if I have missed something), and all servers with network access can connect to it. However, you can follow the steps here for proper configuration: https://www.alibabacloud.com/help/doc-detail/56464.htm

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
11月前
|
弹性计算 NoSQL Linux
在Alibaba Cloud Linux系统上安装Redis数据库流程
在Alibaba Cloud Linux系统上安装Redis数据库流程,阿里云持久内存服务器ECS可用于搭建Redis内存型数据库,云服务器吧以阿里云服务器ECS持久内存型、Alibaba Cloud Linux镜像操作系统安装Redis 6.0.5或Redis 3.2.12详细操作流程如下:
242 0
|
3月前
|
canal 缓存 关系型数据库
Springcloud Alibaba使用Canal将Mysql数据实时同步到Redis保证缓存的一致性
canal [kə'næl] ,译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费。其诞生的背景是早期阿里巴巴因为杭州和美国双机房部署,存在跨机房同步的业务需求,实现方式主要是基于业务 trigger 获取增量变更。从 2010 年开始,业务逐步尝试数据库日志解析获取增量变更进行同步,由此衍生出了大量的数据库增量订阅和消费业务。
|
10月前
|
存储 SpringCloudAlibaba 监控
SpringCloud Alibaba 之 Config配置中心,Redis分布式锁详解(下)
SpringCloud Alibaba 之 Config配置中心,Redis分布式锁详解(
160 0
|
10月前
|
SpringCloudAlibaba NoSQL 前端开发
SpringCloud Alibaba 之 Config配置中心,Redis分布式锁详解(上)
SpringCloud Alibaba 之 Config配置中心,Redis分布式锁详解
119 0
|
11月前
|
弹性计算 NoSQL Linux
教程:Alibaba Cloud Linux部署Redis数据库
Alibaba Cloud Linux 2针对Redis应用进行了专项调优,相比社区版操作系统,Redis应用整体性能提升20%以上。Alibaba Cloud Linux 2内置Redis 6.0.5和Redis 3.2.12的yum源,执行sudo yum install命令即可部署Redis 6.0.5和Redis 3.2.12。
190 0
|
11月前
|
弹性计算 NoSQL Linux
阿里云ECS安装Alibaba Cloud Linux操作系统部署Redis数据库
阿里云ECS安装Alibaba Cloud Linux操作系统部署Redis数据库,阿里云持久内存型云服务器ECS有re7p、r7p、re6p等,云服务器吧以持久内存型re6p实例ecs.re6p-redis.2xlarge为例,操作系统镜像为Alibaba Cloud Linux 2.1903 LTS 64位,安装Redis 6.0.5或Redis 3.2.12教程如下:
300 0
|
11月前
|
弹性计算 NoSQL Linux
教程:Alibaba Cloud Linux操作系统安装Redis内存型数据库
教程:Alibaba Cloud Linux操作系统安装Redis内存型数据库,阿里云持久内存服务器ECS可用于搭建Redis内存型数据库,云服务器吧以阿里云服务器ECS持久内存型、Alibaba Cloud Linux镜像操作系统安装Redis 6.0.5或Redis 3.2.12详细操作流程如下:
111 0
|
11月前
|
弹性计算 NoSQL Linux
阿里云服务器持久内存Alibaba Cloud Linux安装Redis数据库流程
阿里云服务器持久内存Alibaba Cloud Linux安装Redis数据库流程,阿里云持久内存服务器ECS可用于搭建Redis内存型数据库,云服务器吧以阿里云服务器ECS持久内存型、Alibaba Cloud Linux镜像操作系统安装Redis 6.0.5或Redis 3.2.12详细操作流程如下:
119 0
|
11月前
|
弹性计算 NoSQL Linux
阿里云持久内存服务器安装Redis by Alibaba Cloud Linux
阿里云持久内存型云服务器ECS有re7p、r7p、re6p等,云服务器吧以持久内存型re6p实例ecs.re6p-redis.2xlarge为例,操作系统镜像为Alibaba Cloud Linux 2.1903 LTS 64位,安装Redis 6.0.5或Redis 3.2.12教程如下:
133 0
|
11月前
|
弹性计算 NoSQL Linux
阿里云服务器Alibaba Cloud Linux操作系统安装Redis流程及命令
阿里云服务器Alibaba Cloud Linux操作系统安装Redis流程及命令,Alibaba Cloud Linux 2针对Redis应用进行了专项调优,相比社区版操作系统,Redis应用整体性能提升20%以上。Alibaba Cloud Linux 2内置Redis 6.0.5和Redis 3.2.12的yum源,执行sudo yum install命令即可部署Redis 6.0.5和Redis 3.2.12。
293 0