After the zimg server image data is migrated, the problem of abnormal image 404 is solved

Due to the special image storage structure and image naming rules of zimg, its migration data should be quite simple, just copy the corresponding folder where the image data is stored. There is always some cost in simple things. The following are some of the problems I encountered during the simple migration test process, for reference only [The similarities and differences of the configuration files of the two services do not affect data migration]

 

First eliminate the problems caused by the migration of the lower version to the higher version. For example, the file format of zimg 2.x is 0_0, but the storage format of the new version zimg 3.x becomes 0*0.

 

 

1. Directly from the A server, download the data to the windows local, and then upload the local file to another server B

 

2. Access the image address on the B service directly from the browser, and the result shows 404 Not Found!

 

3. Check the zimg log, because it is the default log level, there is no substantial log output 

(2017/08/18 15:44:50:056841 [ERROR] 192.168.1.179 fail pic:f1cfc5f870c192fbfbc6b24a0c390b89 w:0 h:0 p:1 g:0 x:-1 y:-1 r:0 q:75 f:none)

 

4. Modify the zimg.lua configuration file of the B service and adjust the log level to 7, that is, output the debug detailed log

 

        2017/08/18 15:44:50:055948 [DEBUG] Method: 0
	2017/08/18 15:44:50:056029 [DEBUG] Got a GET request for </f1cfc5f870c192fbfbc6b24a0c390b89>
	2017/08/18 15:44:50:056057 [DEBUG] md5 of request is <f1cfc5f870c192fbfbc6b24a0c390b89>
	2017/08/18 15:44:50:056079 [DEBUG] get_img() start processing zimg request...
	2017/08/18 15:44:50:056104 [DEBUG] whole_path: /usr/local/src/zimg/bin/img/967/1009/f1cfc5f870c192fbfbc6b24a0c390b89
	2017/08/18 15:44:50:056133 [DEBUG] Path[/usr/local/src/zimg/bin/img/967/1009/f1cfc5f870c192fbfbc6b24a0c390b89] is A Dir.
	2017/08/18 15:44:50:056164 [DEBUG] key: f1cfc5f870c192fbfbc6b24a0c390b89:0:0:1:0:-1:-1:0:75:none
	2017/08/18 15:44:50:056322 [DEBUG] Cache Result: SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY
	2017/08/18 15:44:50:056365 [DEBUG] Start to Find the Image...
	2017/08/18 15:44:50:056387 [DEBUG] 0rig File Path: /usr/local/src/zimg/bin/img/967/1009/f1cfc5f870c192fbfbc6b24a0c390b89/0*0
	2017/08/18 15:44:50:056423 [DEBUG] Got the rsp_path: /usr/local/src/zimg/bin/img/967/1009/f1cfc5f870c192fbfbc6b24a0c390b89/0*0_p1_g0_-1*-1_r0_q75.none
	2017/08/18 15:44:50:056517 [DEBUG] Cache Result: SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY
	2017/08/18 15:44:50:056551 [DEBUG] Not Hit Original Image Cache. Begin to Open it.
	2017/08/18 15:44:50:056752 [DEBUG] Open Original Image From Disk Failed! 0 != 1
	2017/08/18 15:44:50:056789 [DEBUG] Open Original Image From Disk Failed!
	2017/08/18 15:44:50:056817 [DEBUG] zimg Requset Get Image[MD5: f1cfc5f870c192fbfbc6b24a0c390b89] Failed!
	2017/08/18 15:44:50:056841 [ERROR] 192.168.1.179 fail pic:f1cfc5f870c192fbfbc6b24a0c390b89 w:0 h:0 p:1 g:0 x:-1 y:-1 r:0 q:75 f:none
	2017/08/18 15:44:50:056881 [DEBUG] ============get_request_cb() ERROR!===============
	2017/08/18 15:44:50:106540 [DEBUG] Method: 0
	2017/08/18 15:44:50:106610 [DEBUG] favicon.ico Request, Denied.
	2017/08/18 15:44:50:106641 [DEBUG] headers: 1

 

5. Carefully check the above log and find that the actual requested file is recorded as

/usr/local/src/zimg/bin/img/967/1009/f1cfc5f870c192fbfbc6b24a0c390b89/0*0_p1_g0_-1*-1_r0_q75.none

Go back to the directory location corresponding to the B server and find that the file does not exist. So, 404 errors are normal

 

6. Open xftp (or other tools), and find that the file name has changed during the transfer to the local win -> 0*0 has become 0_0 , win thinks that the file name contains * is an illegal character, and directly converted it . (Not taking into account the issue of filename changes at all)

 

7. Compress the file tar.gz on the A server , download it locally, keep the file name unchanged, upload it to the corresponding directory of the B server, and perform the tar decompression operation.

 

Open the file you just migrated again and find that it can be displayed normally.

Follow the official account to get more related technical articles

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326321693&siteId=291194637