当前位置:网站首页>Operation and maintenance guide | cos back source setting practice

Operation and maintenance guide | cos back source setting practice

2022-06-24 17:24:00 zrongzhou

One 、 Back to source setting function introduction

1. brief introduction

Can pass Object storage Console , Set the back to source rule for buckets , When the requested object does not exist in the bucket or a specific request needs to be redirected , You can use the back to source rule from COS Access to the corresponding data . Setting back to source is mainly used for data thermal migration 、 Redirection of specific requests, etc , You can set it according to your actual needs .

explain :

  • The success rate of pulling data back to the source depends on the network environment , Please give priority to telecommunication 、 Move 、 Unicom, etc IP paragraph .
  • The bucket in the financial cloud region does not support the back to source setting .

Two 、 Schematic diagram of offline back to source and synchronous back to source architecture

1. Offline back to source diagram

2. Synchronization back to source diagram

3、 ... and 、 Console Configuration Guide

1. Operation steps

1) Sign in Object bucket console , Select the left menu bar 【 Bucket list 】, Go to the bucket list page . Click the bucket you want to set back to the source , Go to the bucket details page .

2) Click on the left 【 Basic configuration 】>【 Back to source settings 】 Configuration item , And then click 【 Add back to source rule 】.

3) Follow the configuration item instructions below to configure , Finally, click 【 preservation 】 that will do .

Back to source conditions : You can select the conditions to trigger back to the source according to your needs , To trigger back to source, all configured back to source conditions must be met at the same time .

  • HTTP Status code : Currently, only the condition is HTTP Status code 404 Trigger back to source , This item is required and cannot be cancelled .
  • File name prefix : When the requested file name prefix matches , Can trigger back to source rule . for example : Set the file name prefix to prefix, Then visit https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/prefix123.jpg And back to HTTP Status code for 404 when , Will trigger the back to source rule .

Back to source protocol :COS Used to access the specified origin HTTP agreement , The option is mandatory HTTPS、 mandatory HTTP And follow the request protocol .

  • Optional coercion HTTPS/HTTP, be COS Will HTTPS/HTTP Protocol access source .
  • Choose follow request protocol ,COS I will ask for COS The protocol used to access the origin .

Back to source address : Just fill in the domain name or IP Address , Support domain name or IP Add the port number after the address . No need to prefix http:// or https://. The correct example address is as follows :

Back to source address supports specific address settings , It can be configured as the following configuration items .

  • Fixed files : When the back to source rule is triggered , Jump to fixed files by default .
  • Specify prefix : When the back to source rule is triggered , Jump to the file with the specified prefix . For example, specify the prefix as test, visit https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/prefix123.jpg Trigger back to source rule when , It will jump to < Back to source address >/test/prefix123.jpg;
  • Specify suffix : When the back to source rule is triggered , Jump to the file with the specified suffix . For example, specify the suffix as .jpg, visit https://examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/prefix123 Trigger back to source rule when , It will jump to < Back to source address >/prefix123.jpg;

Be careful :

  • When selecting a fixed file , The other two types are not optional by default .
  • The configuration of the specified prefix and the specified suffix can take effect at the same time .

Synchronize back to source : After turning on sync back to source , When COS When you need to go to the source station to pull data, it will not return 3XX Status code . Currently, this configuration item only supports Beijing 、 Shanghai 、 Singapore 、 The bucket in Mumbai .

3xx Follow the strategy : After opening , When the source station returns 3XX When redirecting the status code ,COS The default processing strategy of is follow 3XX Go to another source station to pull data again , If you select close, resources will not be pulled .

Back to source parameters : Specifies whether to access COS The request parameters carried by the server are transmitted to the source station .

Back to the source head :COS When visiting the origin , You can carry the specified new header to access . At present, it supports at most adding 10 A custom header .

4) When the rules are added , The system will assign the highest priority to your new rules ;COS Will return to the source according to the highest priority rule ; In addition, it can also be found on the rule list page , Click the Modify button to adjust the priority .

Four 、 Practice operation of offline and synchronous back to source

1. Offline back to source case

1) First, in the COS Console add back to source rule , The configuration is as follows ; among , Return to the source address and fill in the Internet address of the source station 111.230.xxx.xxx , Sync back to source selection “ close ” , Other settings can be configured according to the actual situation .

2) Add a COS Test files that don't exist on test-1.txt, And ensure that through the source station can be normal access ; At the same time, you can see that there is no test-1.txt file .

3) The origin uses nginx , Through here tail -f Under the way of monitoring nginx Access log , It is convenient to verify the request process of offline return to the source later .

4) Now through cos Domain name for access testing , As you can see from the test results , The client received it first cos Back to 302 after , I went to the source station again test-1.txt file , also cos A source station is also initiated after the delay test-1.txt File request , And finally pull and save the file to cos On .

2. Sync back to source cases

1) First, in the COS Console add back to source rule , The configuration is as follows ; among , Return to the source address and fill in the Internet address of the source station 111.230.xxx.xxx, Sync back to source selection “ Turn on ” , Other settings can be configured according to the actual situation .

2) Add a COS Test files that don't exist on test-2.txt, And ensure that through the source station can be normal access ; At the same time, you can see that there is no test-2.txt file .

3) The origin uses nginx , Through here tail -f Under the way of monitoring nginx Access log , It is convenient to verify the request process of synchronization back to the source later .

4) Now through cos Domain name for access testing , As you can see from the test results , The client receives it directly cos Back to 200 Respond to , instead of 302 Respond to ; meanwhile cos Also launched a source station test-2.txt File request , And finally pull and save the file to cos On .

原网站

版权声明
本文为[zrongzhou]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/03/20210320120317177f.html