{"id":450,"date":"2019-09-27T10:10:55","date_gmt":"2019-09-27T02:10:55","guid":{"rendered":"https:\/\/www.myway5.com\/?p=450"},"modified":"2023-07-05T21:40:36","modified_gmt":"2023-07-05T13:40:36","slug":"file-upload-in-distributed-system","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/","title":{"rendered":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848"},"content":{"rendered":"<p>-## \u4e00\u3001\u80cc\u666f<br \/>\n\u8003\u8651\u53ef\u6269\u5c55\u6027\uff0c\u540e\u53f0\u7684\u670d\u52a1\u80af\u5b9a\u662f\u8981\u80fd\u591f\u652f\u6301\u4efb\u610f\u7684\u6269\u5c55\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5728\u4e1a\u52a1\u91cf\u589e\u957f\u65f6\u901a\u8fc7\u589e\u52a0\u673a\u5668\u7684\u65b9\u5f0f\u6765\u5e94\u5bf9\u3002\u8fd9\u5bf9\u540e\u53f0\u670d\u52a1\u63d0\u51fa\u4e86\u4e00\u4e2a\u8981\u6c42\uff0c\u5fc5\u987b\u5904\u7406\u597d\u5206\u5e03\u5f0f\u73af\u5883\u548c\u5355\u673a\u73af\u5883\u7684\u4e0d\u540c\u5e26\u6765\u7684\u95ee\u9898\u3002\u6bd4\u5982\uff1a\u5728\u6587\u4ef6\u7684\u5206\u7247\u4e0a\u4f20\u8fd9\u4e00\u573a\u666f\u4e0b\uff0c\u5e94\u8be5\u8d1f\u8f7d\u5747\u8861\u7684\u95ee\u9898\uff0c\u4e00\u4e2a\u6587\u4ef6\u7684\u591a\u4e2a\u5206\u7247\u8bf7\u6c42\u4f1a\u5206\u5e03\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u5bfc\u81f4\u5728\u5c06\u591a\u4e2a\u5206\u7247\u5408\u5e76\u6210\u5b8c\u6574\u6587\u4ef6\u65f6\u51fa\u73b0\u95ee\u9898\uff0c\u800c\u5355\u673a\u60c5\u51b5\u4e0b\u5219\u5b8c\u5168\u4e0d\u4f1a\u6709\u8fd9\u6837\u7684\u95ee\u9898\u3002<\/p>\n<h2>\u4e8c\u3001\u96be\u70b9<\/h2>\n<p>\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u6709\u5f88\u591a\u79cd\uff0c\u4f46\u662f\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u5c3d\u91cf\u9009\u62e9\u7b80\u6d01\u3001\u6613\u90e8\u7f72\u548c\u7ef4\u62a4\u7684\u65b9\u6848\u8fdb\u884c\uff0c\u5e76\u4e14\u4e0d\u80fd\u4e22\u6389\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u4f18\u70b9\u3002\u6bd4\u5982\u7f51\u4e0a\u7684\u6709\u7684\u65b9\u6848\u662f\u4f7f\u7528\u5355\u72ec\u7684\u6587\u4ef6\u4e0a\u4f20\u670d\u52a1\u5668\uff0c\u4f46\u662f\u8fd9\u5c31\u53d8\u6210\u4e86\u5355\u673a\u670d\u52a1\u4e86\u3002\u4e5f\u6709\u4f7f\u7528NFS\u6302\u8f7d\u7684\u65b9\u6848\uff0c\u5373\u6240\u6709\u7684\u670d\u52a1\u5668\u6302\u8f7d\u4e00\u4e2a\u76f8\u540c\u7684NFS\u76ee\u5f55\uff0c\u6240\u6709\u4e0a\u4f20\u76f8\u5173\u7684\u6587\u4ef6\u90fd\u5b58\u653e\u5728\u6302\u8f7d\u7684\u76ee\u5f55\u4e0b\uff0c\u8fd9\u4e0d\u4ec5\u7ed9\u8fd0\u7ef4\u5e26\u6765\u4e86\u9ebb\u70e6\uff0c\u4e3a\u4e86\u4fdd\u8bc1NFS\u7684\u9ad8\u53ef\u7528\uff0c\u4e5f\u5e26\u6765\u4e86\u989d\u5916\u7684\u8fd0\u7ef4\u6210\u672c\u3002<\/p>\n<h2>\u4e09\u3001\u89e3\u51b3\u65b9\u6848<\/h2>\n<h3>3.1 \u501f\u52a9\u8d1f\u8f7d\u5747\u8861<\/h3>\n<p>\u501f\u52a9\u8d1f\u8f7d\u5747\u8861\u7684\u65b9\u6848\u5f88\u7b80\u5355\uff0c\u8fd9\u662f\u548c\u5e94\u7528\u65e0\u5173\u7684\u4e00\u79cd\u65b9\u6cd5\u3002\u5373\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\u8fd9\u4e00\u5c42\uff0c\u5c06\u540c\u4e00\u4e2a\u6587\u4ef6\u7684\u4e0d\u540c\u5206\u7247\u7684\u8bf7\u6c42\u5168\u90e8\u5bfc\u5411\u5230\u540c\u4e00\u4e2a\u670d\u52a1\u5668\u4e0a\u3002\u6bd4\u5982\u8d1f\u8f7d\u5747\u8861\u8fd9\u4e00\u5757\u4f7f\u7528\u7684\u662fnginx, \u901a\u8fc7<code>url hash<\/code>\u7684\u65b9\u5f0f\u6765\u5b8c\u6210\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u7684\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"line-numbers\">upstream backend {\n    server 0.0.0.0:8080;\n    server 0.0.0.0:8081;\n    server 0.0.0.0:8082;\n    hash <span class=\"katex math inline\">request_uri;\n}\nserver {\n    location \/ {\n        proxy_pass http:\/\/backend;\n        proxy_set_header X-Real-IP<\/span>remote_addr;\n        proxy_set_header Host $host;\n    }\n}\n<\/code><\/pre>\n<p>\u7136\u540e\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u670d\u52a1\u6765\u9a8c\u8bc1\u4e00\u4e0b\uff1a<\/p>\n<pre><code class=\"language-go line-numbers\">func post(resp http.ResponseWriter, req *http.Request) {\n    v := req.PostFormValue(\"key\")\n    identity := req.PostFormValue(\"identity\")\n    log.Printf(\"identity: %v, value: %v\\n\", identity, v)\n\n    resp.WriteHeader(http.StatusOK)\n    _, err := resp.Write([]byte(\"ok\"))\n    if err != nil {\n        log.Println(\"error:\", err)\n    }\n}\n\nfunc main() {\n    var addr string\n    flag.StringVar(&amp;addr, \"addr\", \"0.0.0.0:8080\", \"http listen addr:port\")\n    flag.Parse()\n\n    http.HandleFunc(\"\/Post\", post)\n    log.Println(\"listen \", addr)\n    err := http.ListenAndServe(addr, nil)\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n<\/code><\/pre>\n<p>\u6211\u4eec\u542f\u52a8\u4e09\u4e2a\u670d\u52a1:<\/p>\n<pre><code class=\"line-numbers\">.\/godemo -addr 0.0.0.0:8080\n.\/godemo -addr 0.0.0.0:8081\n.\/godemo -addr 0.0.0.0:8082\n<\/code><\/pre>\n<p>\u4f7f\u7528curl\u6765post\u6570\u636e\u8fc7\u6765\uff0c\u8bf7\u6c42\u7684\u5730\u5740\u7c7b\u4f3c\u4e8e: <code>http:\/\/0.0.0.0\/Post?123456<\/code>\u3002<code>?<\/code>\u540e\u9762\u53ef\u4ee5\u5f53\u6210\u662f\u6587\u4ef6\u7684\u552f\u4e00\u6807\u8bc6\u7801\uff0c\u6bd4\u5982\u6587\u4ef6\u548c\u7528\u6237id\u7684\u7ec4\u5408\u7684md5\u4fe1\u606f\u7b49\uff0c\u8fd9\u6837\u5bf9\u4e8e\u540c\u4e00\u4e2a\u7528\u6237\u4e0a\u4f20\u7684\u540c\u4e00\u4e2a\u6587\u4ef6\u7684\u4e0d\u540c\u5206\u7247\u8bf7\u6c42\uff0c\u901a\u8fc7url\u54c8\u5e0c\u90fd\u4f1a\u5f97\u5230\u540c\u6837\u7684\u7ed3\u679c\uff0c\u8fd9\u6837\u5c31\u4f1a\u88ab\u8f6c\u53d1\u5230\u540c\u4e00\u4e2a\u540e\u7aef\u670d\u52a1\u5668\u3002<\/p>\n<pre><code class=\"line-numbers\">curl http:\/\/0.0.0.0\/Post\\?123456 -d \"key=value&amp;identity=123456\" -X POST\ncurl http:\/\/0.0.0.0\/Post\\?123456 -d \"key=value&amp;identity=123456\" -X POST\ncurl http:\/\/0.0.0.0\/Post\\?123456 -d \"key=value&amp;identity=123456\" -X POST\ncurl http:\/\/0.0.0.0\/Post\\?789abc -d \"key=vvvvv&amp;identity=789abc\" -X POST\ncurl http:\/\/0.0.0.0\/Post\\?789abc -d \"key=vvvvv&amp;identity=789abc\" -X POST\ncurl http:\/\/0.0.0.0\/Post\\?789abc -d \"key=vvvvv&amp;identity=789abc\" -X POST\n<\/code><\/pre>\n<p>\u7ed3\u679c\u5982\u4e0b:<\/p>\n<pre><code class=\"line-numbers\">\u7aef\u53e38080\u7684\u670d\u52a1\u6536\u5230\u4e86\u4e09\u6761\u8bf7\u6c42:\n2019\/09\/26 13:58:52 identity: 123456, value: value\n2019\/09\/26 13:58:56 identity: 123456, value: value\n2019\/09\/26 13:59:03 identity: 123456, value: value\n\n\u7aef\u53e38081\u7684\u670d\u52a1\u6536\u5230\u4e86\u4e09\u6761\u8bf7\u6c42:\n2019\/09\/26 13:59:40 identity: 789abc, value: vvvvv\n2019\/09\/26 13:59:43 identity: 789abc, value: vvvvv\n2019\/09\/26 13:59:44 identity: 789abc, value: vvvvv\n<\/code><\/pre>\n<p>\u5982\u679c\u5728k8s\u96c6\u7fa4\u4e2d\u90e8\u7f72\uff0c\u4f7f\u7528<code>nginx-ingress<\/code>\u7684\u8bdd\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u7684\u90e8\u7f72\u65b9\u6848\uff1a<\/p>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: networking.k8s.io\/v1beta1\nkind: Ingress\nmetadata:\n    name: pipeline-ingress\n    namespace: default\n    annotations:\n      nginx.ingress.kubernetes.io\/proxy-body-size: \"50m\"\n      nginx.ingress.kubernetes.io\/upstream-hash-by: \"$request_uri\"\nspec:\n    rules:\n        - host: pipeline.dev.com\n          http:\n              paths:\n                  - path: \/ \n                    backend:\n                        serviceName: pipeline-service\n                        servicePort: 8888\n\n<\/code><\/pre>\n<p>\u5f53\u7136\u8fd9\u79cd\u65b9\u5f0f\u9700\u8981\u6ce8\u610f\u4f60\u7684\u6bcf\u4e2a\u8bf7\u6c42\u7684<code>URI<\/code>\u90fd\u9700\u8981\u52a0\u4e0a\u989d\u5916\u7684\u53c2\u6570\uff08\u6bd4\u5982\u7528\u6237\u7684userId\u7684md5)\uff0c\u8fd9\u6837\u624d\u80fd\u5747\u5300\u7684\u5206\u5e03\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n<h2>3.2 \u540e\u53f0\u7a0b\u5e8f\u81ea\u52a8proxy\u8bf7\u6c42<\/h2>\n<p>\u8fd9\u4e2a\u65b9\u6848\u7684\u601d\u8def\u662f\u96c6\u7fa4\u4e2d\u7684\u6bcf\u4e2a\u670d\u52a1\u5b9e\u4f8b\u90fd\u6709\u5355\u72ec\u7684\u6807\u8bc6\uff0c\u6587\u4ef6\u5206\u7247\u5728\u7b2c\u4e00\u6b21\u4e0a\u4f20\u65f6\u4f1a\u8fd4\u56de\u7ed9\u5b83\u4e00\u4e2a\u8be5\u8bf7\u6c42\u6240\u5c5e\u670d\u52a1\u5668\u7684identity\uff0c\u4e4b\u540e\u6240\u6709\u7684\u8bf7\u6c42\u4f1a\u5e26\u4e0a\u8fd9\u4e2aidentity\uff0c\u4e4b\u540e\u6536\u5230\u8bf7\u6c42\u7684\u670d\u52a1\u5668\u4f1a\u68c0\u67e5\u8fd9\u4e2aidentity\u662f\u4e0d\u662f\u5c5e\u4e8e\u81ea\u5df1\uff0c\u5982\u679c\u4e0d\u5c5e\u4e8e\u81ea\u5df1\uff0c\u5219\u628a\u8fd9\u4e2a\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u6240\u5c5e\u7684\u670d\u52a1\u5668\u3002<\/p>\n<p>\u8fd9\u4e2a\u65b9\u6848\u8981\u6c42\u6bcf\u53f0\u670d\u52a1\u5668\u90fd\u77e5\u9053\u5176\u4ed6\u6240\u6709\u670d\u52a1\u5668\u7684identity\u548c\u5730\u5740\u3002\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>etcd<\/code>\u8fd9\u6837\u7684\u5206\u5e03\u5f0f\u6570\u636e\u5e93\u6765\u5b58\u50a8\u3002\u6bcf\u53f0\u670d\u52a1\u5668\u5728\u542f\u52a8\u65f6\u90fd\u5411etcd\u91cc\u6ce8\u518c\u81ea\u5df1\u7684identity\u548caddress\uff0c\u4e4b\u540e\u670d\u52a1\u5668\u8f6c\u53d1\u7684\u65f6\u5019\u90fd\u5411etcd\u91cc\u9762\u67e5\u627e\u5bf9\u5e94\u7684address\u5373\u53ef\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\u7684\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"language-go line-numbers\">package main\n\nimport (\n    \"context\"\n    \"encoding\/json\"\n    \"flag\"\n    \"io\/ioutil\"\n    \"log\"\n    \"net\/http\"\n    \"go.etcd.io\/etcd\/clientv3\"\n    \"net\/url\"\n    \"time\"\n)\n\ntype Server struct {\n    Etcd string\n    Addr string\n    Identify string\n}\n\ntype ResponseObj struct {\n    Identity string `json:\"identity,omitempty\"`\n    Value string `json:\"value\"`\n}\n\nfunc getEtcdKV(etcd string) (clientv3.KV, error) {\n    cfg := clientv3.Config{\n        Endpoints:               []string{etcd},\n        \/\/ set timeout per request to fail fast when the target endpoint is unavailable\n        DialTimeout: time.Second,\n    }\n\n    cli, err := clientv3.New(cfg)\n\n    if err != nil {\n        return nil, err\n    }\n\n    return clientv3.NewKV(cli), nil\n}\n\nfunc httpProxy(anotherServer string, body map[string]string) (*http.Response, error) {\n    formData := url.Values{}\n\n    for k, v := range body {\n        formData.Set(k ,v)\n    }\n\n    return http.PostForm(anotherServer, formData)\n}\n\nfunc (s *Server) Register() error {\n    cli, err := getEtcdKV(s.Etcd)\n    if err != nil {\n        return err\n    }\n\n    ctx, cancel := context.WithTimeout(context.Background(), time.Duration(1)*time.Second)\n    _, err = cli.Put(ctx, s.Identify, \"http:\/\/\" + s.Addr)\n    cancel()\n    if err != nil {\n        return err\n    }\n\n    return nil\n}\n\nfunc (s *Server) Post(resp http.ResponseWriter, req *http.Request) {\n    v := req.PostFormValue(\"key\")\n    identity := req.PostFormValue(\"identity\")\n    log.Printf(\"identity: %v, value: %v\\n\", identity, v)\n\n    var data ResponseObj\n\n    if identity != \"\" &amp;&amp; identity != s.Identify {\n        \/\/ proxy\n        cli, err := getEtcdKV(s.Etcd)\n        if err != nil {\n            log.Println(\"get kv client error\", err)\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n\n        etcdResp, err := cli.Get(context.Background(), identity)\n        if err != nil {\n            log.Println(\"get value error: \", err)\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n\n        if len(etcdResp.Kvs) == 0 {\n            log.Println(\"\u6ca1\u6709\u503c\")\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n\n        proxyAddr := string(etcdResp.Kvs[0].Value)\n\n        log.Println(\"proxy to: \", proxyAddr)\n\n        text := map[string]string {\n            \"key\": v,\n            \"identity\": identity,\n        }\n\n        proxyResp, err := httpProxy(proxyAddr+\"\/Post\", text)\n        if err != nil || proxyResp.Body == nil {\n            log.Println(\"http proxy error: \", err)\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n\n        bodyData, err := ioutil.ReadAll(proxyResp.Body)\n        if err != nil {\n            log.Println(\"read proxy body error: \", err)\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n\n        err = json.Unmarshal(bodyData, &amp;data)\n        if err != nil {\n            log.Println(\"json unmarshal error: \", err)\n            resp.WriteHeader(http.StatusInternalServerError)\n            resp.Write([]byte(\"error\"))\n            return\n        }\n    } else {\n        data.Identity = s.Identify\n        data.Value = v\n    }\n\n    text, err := json.Marshal(data)\n    if err != nil {\n        log.Println(\"marshal json error: \", err)\n        resp.WriteHeader(http.StatusInternalServerError)\n        return\n    }\n\n    resp.WriteHeader(http.StatusOK)\n    _, err = resp.Write(text)\n    if err != nil {\n        log.Println(\"error:\", err)\n    }\n}\n\nfunc main() {\n    var addr string\n    var identity string\n    var etcd string\n    flag.StringVar(&amp;addr, \"addr\", \"0.0.0.0:8080\", \"http listen addr:port\")\n    flag.StringVar(&amp;identity, \"identity\", \"\", \"identify the server\")\n    flag.StringVar(&amp;etcd, \"etcd\", \"http:\/\/127.0.0.1:2379\", \"etcd server url\")\n    flag.Parse()\n\n    if identity == \"\" {\n        log.Fatal(\"identity\u4e0d\u53ef\u4e3a\u7a7a\")\n    }\n\n    var server = &amp;Server{\n        Addr:     addr,\n        Identify: identity,\n        Etcd: etcd,\n    }\n\n    err := server.Register()\n    if err != nil {\n        log.Fatal(\"register server error, check your etcd server: \", err)\n    }\n\n    http.HandleFunc(\"\/Post\", server.Post)\n    log.Println(\"listen \", addr)\n    err = http.ListenAndServe(addr, nil)\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n<\/code><\/pre>\n<h2>3.3 \u57fa\u4e8eS3\u5b58\u50a8\u7684\u65b9\u6848<\/h2>\n<p>\u517c\u5bb9S3\u7684\u5b58\u50a8\u7cfb\u7edf\u6709\u4e00\u4e2a\u5bf9\u5916\u7684\u63a5\u53e3\u53eb\u505a: <code>ComposeObject<\/code>\u3002\u8fd9\u4e2a\u63a5\u53e3\u53ef\u4ee5\u5c06\u591a\u4e2a\u6587\u4ef6\u5408\u5e76\u6210\u4e00\u4e2a\u6587\u4ef6\u5b58\u50a8\u5230\u6307\u5b9a\u4f4d\u7f6e\u3002\u5982\u679c\u6211\u4eec\u7684\u5e95\u5c42\u5b58\u50a8\u662f\u57fa\u4e8e\u517c\u5bb9S3\u7684\u7cfb\u7edf\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u5229\u7528\u8fd9\u4e2a\u63a5\u53e3\u8f7b\u677e\u7684\u5b9e\u73b0\u3002<\/p>\n<p>\u65b9\u6848\u7684\u6b65\u9aa4\u53ef\u4ee5\u63cf\u8ff0\u6210\u4ee5\u4e0b\uff1a<\/p>\n<ol>\n<li>\u524d\u7aef\u5b9e\u73b0\u5c06\u6587\u4ef6\u5206\u7247\uff0c\u7136\u540e\u4e0a\u4f20<\/li>\n<li>\u4e0a\u4f20\u7684\u8bf7\u6c42\u4f1a\u56e0\u4e3a\u524d\u7aef\u8d1f\u8f7d\u5747\u8861\u7684\u539f\u56e0\u5206\u5e03\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u4e0a\u4f20\u8bf7\u6c42\u90fd\u8981\u5e26\u4e0a\u8fd9\u4e2a\u6587\u4ef6\u3001\u7528\u6237id\u3001\u968f\u673a\u5b57\u7b26\u4e32\u7ec4\u5408\u7684md5\u503c\uff0c\u670d\u52a1\u5668\u6536\u5230\u8bf7\u6c42\u540e\uff0c\u53ea\u7ba1\u5c06\u5206\u7247\u4e0a\u4f20\u5230\u4ee5md5\u503c\u4e3a\u540d\u7684\u76ee\u5f55\u4e0b\uff0c\u4e00\u65e6\u4e0a\u4f20\u6210\u529f\uff0c\u4f7f\u7528etcd\u6216redis\u8fd9\u6837\u4f5c\u4e3a\u5206\u7247\u8ba1\u6570\u5668+1.<\/li>\n<li>\u5206\u7247\u603b\u6570\u7b49\u4e8e\u603b\u5206\u7247\u6570\u65f6\u8c03\u7528<code>ComposeObject<\/code>\u7ec4\u5408\u6240\u6709\u5206\u7247\u5b58\u50a8\u5230\u6307\u5b9a\u4f4d\u7f6e\u5373\u53ef\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>-## \u4e00\u3001\u80cc\u666f \u8003\u8651\u53ef\u6269\u5c55\u6027\uff0c\u540e\u53f0\u7684\u670d\u52a1\u80af\u5b9a\u662f\u8981\u80fd\u591f\u652f\u6301\u4efb\u610f\u7684\u6269\u5c55\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5728\u4e1a\u52a1\u91cf\u589e\u957f\u65f6\u901a\u8fc7\u589e\u52a0\u673a\u5668\u7684\u65b9 &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93],"tags":[],"class_list":["post-450","post","type-post","status-publish","format-standard","hentry","category-distributed-system"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"-## \u4e00\u3001\u80cc\u666f \u8003\u8651\u53ef\u6269\u5c55\u6027\uff0c\u540e\u53f0\u7684\u670d\u52a1\u80af\u5b9a\u662f\u8981\u80fd\u591f\u652f\u6301\u4efb\u610f\u7684\u6269\u5c55\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5728\u4e1a\u52a1\u91cf\u589e\u957f\u65f6\u901a\u8fc7\u589e\u52a0\u673a\u5668\u7684\u65b9 &hellip; \u7ee7\u7eed\u9605\u8bfb\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-27T02:10:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:40:36+00:00\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848\",\"datePublished\":\"2019-09-27T02:10:55+00:00\",\"dateModified\":\"2023-07-05T13:40:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\"},\"wordCount\":32,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"articleSection\":[\"\u5206\u5e03\u5f0f\u7cfb\u7edf\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\",\"name\":\"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"datePublished\":\"2019-09-27T02:10:55+00:00\",\"dateModified\":\"2023-07-05T13:40:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"-## \u4e00\u3001\u80cc\u666f \u8003\u8651\u53ef\u6269\u5c55\u6027\uff0c\u540e\u53f0\u7684\u670d\u52a1\u80af\u5b9a\u662f\u8981\u80fd\u591f\u652f\u6301\u4efb\u610f\u7684\u6269\u5c55\u7684\uff0c\u8fd9\u6837\u624d\u80fd\u5728\u4e1a\u52a1\u91cf\u589e\u957f\u65f6\u901a\u8fc7\u589e\u52a0\u673a\u5668\u7684\u65b9 &hellip; \u7ee7\u7eed\u9605\u8bfb\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848","og_url":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2019-09-27T02:10:55+00:00","article_modified_time":"2023-07-05T13:40:36+00:00","author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848","datePublished":"2019-09-27T02:10:55+00:00","dateModified":"2023-07-05T13:40:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/"},"wordCount":32,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"articleSection":["\u5206\u5e03\u5f0f\u7cfb\u7edf"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/","url":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/","name":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"datePublished":"2019-09-27T02:10:55+00:00","dateModified":"2023-07-05T13:40:36+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2019\/09\/27\/file-upload-in-distributed-system\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"\u5206\u5e03\u5f0f\u6587\u4ef6\u4e0a\u4f20\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":6406,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":3,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"predecessor-version":[{"id":1574,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/450\/revisions\/1574"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}