WordPress multi-site data coexistence (using Redis at the same time)

 

WordPress multi-site data coexistence (using Redis at the same time)
WordPress uses Redis for multi-site data coexistence

Users who frequently use WordPress and multiple sites should have encountered data conflicts on multiple sites when using redis to cache the database.

There are many ways to deal with this problem. Let's talk about several common ways to use redis at the same time for multiple sites.

 

 

1. Modify the database prefix when creating a WordPress site

WordPress multi-site data coexistence (using Redis at the same time)

We create a database when WordPress is installed in one step, and the default database prefix is: wp_

We can change the characters at will, such as xxx_

In this way, when the data is cached, there will be no data conflicts between the various libraries. This is also the most recommended way. We suggest changing the default database prefix when creating a site in the future.

 

2. Modify the relevant constants in the wp-config.php configuration file

The wp-config.php configuration file is a file that we often modify. This site has posted a lot of codes for adding or deleting various functions in the wp-config.php file.

This method is suitable for sites that have already been created, and is not suitable for situations where the database is re-operated.

This method comes from official documents:

https://github.com/rhubarbgroup/redis-cache/wiki/Connection-Parameters

By default, the object caching plugin will connect to Redis 127.0.0.1:6379 via TCP and select the database 0 library.

To adjust the connection parameters, you can define any of the following constants in the wp-config.php file.

  1. define ( 'WP_REDIS_HOST' , '127.0.0.1' );
  2. define ( 'WP_REDIS_PORT' , 6379 );
  3. // define('WP_REDIS_PASSWORD','secret' );
  4. define ( 'WP_REDIS_TIMEOUT' , 1 );
  5. define ( 'WP_REDIS_READ_TIMEOUT' , 1 );
  6.  
  7.  
  8. // change the database for each site to avoid cache collisions
  9. define ( 'WP_REDIS_DATABASE' , 0 );
  10.  
  11.  
  12. // supported clients: `phpredis`, `credis`, `predis` and `hhvm`
  13. // define('WP_REDIS_CLIENT','phpredis' );
  14.  
  15.  
  16. // automatically delete cache keys after 7 days
  17. // define('WP_REDIS_MAXTTL', 60 * 60 * 24 * 7 );
  18.  
  19.  
  20. // bypass the object cache, useful for debugging
  21. // define('WP_REDIS_DISABLED', true );

Among them define('WP_REDIS_DATABASE', 0); The value 0 behind here is to change the parameters of the redis library. Redis defaults to 16 libraries, and each station can be set to a different value, such as 1 or 2, 3, 4, 5, 6, and so on.

 

Explanation of other setting items (from Google Translate):

 

  1. WP_REDIS_SCHEME (default: tcp )
  2. Specify the protocol used to communicate with the Redis instance. Internally, the client uses the connection class associated with the specified connection scheme. Support tcp ( TCP / IP ), UNIX ( UNIX domain socket), TLS (Transport Layer Security) or HTTP (by Webdis the HTTP protocol).
  3.  
  4.  
  5. WP_REDIS_HOST (default value: 127.0 . 0.1 )
  6. The IP or host name of the target server . This will be ignored when connecting to Redis using UNIX domain sockets .
  7.  
  8.  
  9. WP_REDIS_PORT (default value: 6379 )
  10. The TCP / IP port of the target server . This will be ignored when connecting to Redis using UNIX domain sockets .
  11.  
  12.  
  13. WP_REDIS_PATH (default: not set)
  14. Using UNIX domain sockets connected to Redis used for UNIX path domain socket file.
  15.  
  16.  
  17. WP_REDIS_DATABASE (default value: 0 )
  18. Accept the value used to automatically select the logical database through the SELECT command.
  19.  
  20.  
  21. WP_REDIS_PASSWORD (default: not set)
  22. Accept a value that is used to authenticate to the password-protected Redis server through the AUTH command .
  23.  
  24.  
  25. To use the Redis . 6 of the ACL , set it to [ 'username' , 'password' ] array (required PhpRedis 5.3 +).
  26.  
  27.  
  28. WP_REDIS_TIMEOUT (default value: 5 )
  29. The time (in seconds) to try to initially connect to the Redis server before failing (a fraction of a second is allowed).
  30.  
  31.  
  32. WP_REDIS_READ_TIMEOUT (default value: 5 )
  33. The time (in seconds) to try to read from the Redis server before failing (a fraction of a second is allowed).
  34.  
  35.  
  36. WP_REDIS_RETRY_INTERVAL (default: not set)
  37. The time (in milliseconds) to retry failed connection attempts.

3. Change the redis cache plugin configuration file

WordPress multi-site data coexistence (using Redis at the same time)

Take the Redis Object Cache caching plugin as an example.

The file directory of this plugin on the server is /wp-content/plugins/redis-cache/

There is an object-cache.php file in its includes directory, just modify it.

WordPress multi-site data coexistence (using Redis at the same time)

Roughly at line 546, just change the database value, the default value is 0

Restart the Redis Object Cache cache plug-in after saving the file.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

In our daily website building, we often use the service to test the loading speed of the website. At the same time, it is sometimes impossible to determine whether it is the problem of the server itself or other problems of the network. We also need to ping the server's IP. Finally, to test line or VPS hosting server, we also need the server IP for routing track.

This article will share the most useful online speed measurement and Ping tools for servers and websites at home and abroad , mainly domestic online tools, and some foreign online speed measurement tools that provide domestic nodes are also included. The function is the online Ping response, web page loading speed test and server IP routing tracking of the three networks of China Telecom, China Unicom and China Mobile .

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

 

1. Chinaz webmaster tools

URL:

  1. https : // ping .chinaz.com

The Chinaz webmaster tool provides Ping detection, domestic speed measurement, international speed measurement, and website speed comparison. Domestic speed measurement includes telecommunications, multi-line, China Unicom, and China Mobile.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Two, Ping.PE

URL:

  1. https : // ping .pe

Ping.PE is a foreign online web tool that focuses on Ping response monitoring. There are domestic and foreign nodes, but there are relatively few domestic nodes.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Three, 17CE

URL:

  1. HTTPS : //www.17ce.com/

17CE is a professional speed measurement online tool in China. There are Get, Ping and route tracking speed measurement. The speed measurement results are quite reliable.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Four, PageSpeedInsights

URL:

  1. HTTPS : //developers.google.com/speed/pagespeed/insights

PageSpeedInsights is an online tool developed by Google to analyze the loading speed of webpages. The advantage is that it can help you quickly find files that slow down the opening speed of the webpage, and propose optimization suggestions that meet the requirements. The disadvantage is that it cannot be opened and is suitable for foreign websites.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Five, IPIP.NET

URL:

  1. HTTPS : //tools.ipip.net/ping.php

The online ping and route tracking service based on the IP library of IPIP.net is characterized by more accurate IP.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

6. Alibaba Cloud website operation and maintenance testing platform

URL:

  1. HTTPS : //zijian.aliyun.com/detect/http/

The Alibaba Cloud website operation and maintenance detection platform includes Http detection, Ping detection, DNS detection, and route tracking detection. It can be divided into regions, such as Northeast, South, North, East, Central, Southwest, and Northwest. Operators are divided into Telecom, China Unicom, and China Mobile. Wait.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Seven, BOCE

URL:

  1. HTTPS : //www.boce.com

BOCE provides website speed measurement, PING detection, DNS query, route tracking query, IPv6 detection, etc. It can specify operator nodes: telecommunications, mobile, China Unicom, education network, etc., and there are still many nodes provided.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Eight, Webkaka

URL:

  1. HTTP : //www.webkaka.com/

Webkaka is a veteran online website testing tool. The page is ugly and the ads are huge. The advantage is that Webkaka provides more speed measurement nodes, including domestic website speed measurement, global website speed measurement, local website speed measurement, website speed diagnosis, and website optimization tools. , Ping test, route tracking, DNS query, etc.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

Nine, love station network Ping

URL:

  1. HTTPS : //ping.aizhan.com/

A relatively simple online Ping tool provided by Aizhan.com.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

10. Dotcom-Tools

URL:

  1. HTTPS : //www.dotcom-tools.com/website-speed-test

Dotcom-Tools Website Speed ​​Test is a foreign website speed test and online Ping tool. Although it is a foreign website, the speed test nodes are domestic, and there are more than 30 speed test nodes in the world.

Top Ten Servers and Websites Online Speed ​​Test and Ping Tools-Online Website Speed ​​Test, Ping, and Route Tracking

WordPress引流插件 关注公众号获取验证码

我们看到有很多的资源下载类网站,包括有很多的范文类网站当我们点击下载、复制文章的时候是有看到需要关注公众号然后输入指定的关键字才可以获取到验证码,填写验证码才可以激活我们需要的内容。这个方式在引流公众号上确实是不错的,尤其是我们目前有需要做私域流量的。

目前市面上WordPress这类的插件不多,有些是固定的验证码,但是这个插件可以实现一段时间不同的随机验证码方式,但是也有一些缺点,比如缓存插件使用后可能会有故障,但是勉强算是可以使用的。

安装插件之后我们可以看到需要设置参数,设置之后我们可以在微信公众号设置自动回复的链接。

我们需要到自动回复中填写设置连接回程。
<a href="http://我们的网站URL/api.php?url_captcha=get_captcha">查看验证码</a>
设置之后,我们就可以在WP中可以看到插入短代码。

这样我们就可以实现需要隐藏的内容包含在短代码里。

本文转自瑞驰杂刊-Rvich Blog文章