{"id":193581,"date":"2020-06-12T09:27:43","date_gmt":"2020-06-12T01:27:43","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=193581"},"modified":"2020-06-10T09:28:07","modified_gmt":"2020-06-10T01:28:07","slug":"linux-pigz-compress","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-pigz-compress.html","title":{"rendered":"Linux\u4e2d\u4f7f\u7528pigz\u5de5\u5177\u66f4\u5feb\u7684\u538b\u7f29\u548c\u89e3\u538b\u6587\u4ef6"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\npigz(parallel implementation of gzip)\u662f\u4e00\u4e2a\u5e76\u884c\u6267\u884c\u7684\u538b\u7f29\u5de5\u5177\uff0c\u89e3\u538b\u7f29\u6bd4gzip\u5feb\uff0c\u540c\u65f6CPU\u6d88\u8017\u662fgzip\u7684\u597d\u51e0\u500d\uff0c\u5728\u5bf9\u77ed\u65f6\u95f4\u5185CPU\u6d88\u8017\u8f83\u9ad8\u4e0d\u53d7\u5f71\u54cd\u7684\u573a\u666f\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528pigz\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u73af\u5883<\/strong><\/div>\n

Centos7 RAM:2GB , CPU: 4vcpus<\/p>\n

\u5b89\u88c5<\/strong><\/div>\n
\r\n# \u5b89\u88c5epel\u6269\u5c55\u6e90\r\n[root@localhost ~]# wget -O \/etc\/yum.repos.d\/epel-7.repo http:\/\/mirrors.aliyun.com\/repo\/epel-7.repo\r\n[root@localhost ~]# yum makecache\r\n# \u5b89\u88c5pigz\r\n[root@localhost ~]# yum -y install pigz\r\n<\/pre>\n
\u5982\u4f55\u538b\u7f29\u6587\u4ef6<\/strong><\/div>\n

\u4e0b\u9762\u51e0\u4e2a\u662f\u5e38\u7528\u53c2\u6570\uff1a<\/p>\n

    \n
  • -p n<\/code>: \u538b\u7f29\u65f6\u4f7f\u7528\u7684\u6838\u5fc3\u6570\u91cf\uff0c\u9ed8\u8ba4\u4f7f\u7528\u6240\u6709\u6838\u5fc3<\/li>\n
  • -k<\/code>: \u538b\u7f29\u540e\u4fdd\u7559\u6e90\u6587\u4ef6<\/li>\n
  • -l<\/code>: \u5217\u51fa\u538b\u7f29\u8f93\u5165\u7684\u5185\u5bb9\u3002<\/li>\n
  • -6<\/code>: \u9ed8\u8ba4\u7684\u538b\u7f29\u7ea7\u522b<\/li>\n
  • -9<\/code>: \u538b\u7f29\u7387\u6700\u9ad8\uff0c\u4f46\u662f\u901f\u5ea6\u6162<\/li>\n
  • -1<\/code>: \u538b\u7f29\u7387\u6700\u4f4e\uff0c\u901f\u5ea6\u6700\u5feb<\/li>\n<\/ul>\n

    \u4f8b\u5982\uff1a\u538b\u7f29FreeNAS-11.2-U7.iso<\/code>\u6587\u4ef6\uff0c\u5982\u679c\u9700\u8981\u4fdd\u7559\u6e90\u6587\u4ef6\uff0c\u53ef\u4ee5\u6dfb\u52a0-k<\/code>\u53c2\u6570\uff1a<\/p>\n

    \r\n[root@localhost ~]# pigz -k FreeNAS-11.2-U7.iso \r\n<\/pre>\n

    \"\"
    \n\u53ef\u4ee5\u4f7f\u7528-l<\/code>\u9009\u9879\u67e5\u770b\u538b\u7f29\u540e\u6587\u4ef6\u7684\u538b\u7f29\u7387\uff1a<\/p>\n

    \r\n[root@localhost ~]# pigz -l FreeNAS-11.2-U7.iso.gz \r\ncompressed   original reduced  name\r\n 576426218  602378240    4.3%  FreeNAS-11.2-U7.iso\r\n<\/pre>\n

    \"\"<\/p>\n

    \u5982\u4f55\u538b\u7f29\u76ee\u5f55<\/strong><\/div>\n

    Pigz\u6ca1\u6709\u538b\u7f29\u6587\u4ef6\u5939\u7684\u9009\u9879\uff0c\u53ea\u53ef\u4ee5\u538b\u7f29\u5355\u4e2a\u6587\u4ef6\u3002pigz\u53ef\u4ee5\u548ctar\u547d\u4ee4\u4e00\u8d77\u4f7f\u7528\uff0c\u6765\u538b\u7f29\u6587\u4ef6\u5939\u3002<\/p>\n

    \r\n[root@localhost ~]# tar -cvf - \/var\/log | pigz -k > logs.tar.gz\r\n<\/pre>\n

    \"\"
    \n\u67e5\u770b\u4e00\u4e0b\u538b\u7f29\u4fe1\u606f\uff1a<\/p>\n

    \r\n[root@localhost ~]# pigz -l logs.tar.gz \r\ncompressed   original reduced  name\r\n    698038    9093120   92.3%  logs.tar\r\n[root@localhost ~]# \r\n<\/pre>\n

    \"\"<\/p>\n

    \u5982\u4f55\u89e3\u538b\u6587\u4ef6<\/strong><\/div>\n

    \u89e3\u538b\u5355\u4e2a\u6587\u4ef6\uff0c\u89e3\u538b\u65b9\u5f0f\uff1a<\/p>\n

    \r\n[root@localhost test]# unpigz -d FreeNAS-11.2-U7.iso.gz \r\n# \u5982\u679c\u9700\u8981\u4fdd\u7559\u6e90\u538b\u7f29\u6587\u4ef6\uff0c\u8bf7\u6dfb\u52a0-k\u53c2\u6570\r\n[root@localhost test]# pigz -k -d FreeNAS-11.2-U7.iso.gz \r\n<\/pre>\n

    \u89e3\u538b\u4e00\u4e2a\u76ee\u5f55\uff0c\u89e3\u538b\u65b9\u5f0f\uff1a<\/p>\n

    \r\n[root@localhost test]# tar -xf logs.tar.gz \r\n<\/pre>\n

    \"\"<\/p>\n

    \u603b\u7ed3<\/strong><\/div>\n

    pigz\u662f\u4e00\u4e2a\u5e76\u884c\u6267\u884c\u7684\u538b\u7f29\u5de5\u5177\uff0c\u89e3\u538b\u7f29\u6bd4gzip\u5feb\uff0c\u540c\u65f6CPU\u6d88\u8017\u662fgzip\u7684\u597d\u51e0\u500d\uff0c\u5728\u5bf9\u77ed\u65f6\u95f4\u5185CPU\u6d88\u8017\u8f83\u9ad8\u4e0d\u53d7\u5f71\u54cd\u7684\u573a\u666f\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528pigz\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

    Centos7 RAM:2GB , CPU: 4vcpus # \u5b89\u88c5epel\u6269\u5c55\u6e90 [root@localho […]<\/p>\n","protected":false},"author":309,"featured_media":193582,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-193581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=193581"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193581\/revisions"}],"predecessor-version":[{"id":193592,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193581\/revisions\/193592"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/193582"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=193581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=193581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=193581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}