github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/sharding/README.md (about)

     1  # Sharding
     2  
     3  A sharding example using the greeter application and a X-From-User header as the sharding key
     4  
     5  ## Contents
     6  
     7  - api.go - a modified version of the greeter api to include sharding
     8  
     9  ## Run 
    10  
    11  ### Greeter Service
    12  
    13  Run multiple copies of the greeter
    14  
    15  ```
    16  cd ../greeter
    17  go run srv/main.go
    18  ```
    19  
    20  ### Greeter API
    21  
    22  ```
    23  go run api.go
    24  ```
    25  
    26  ### Micro API
    27  
    28  ```
    29  micro api
    30  ```
    31  
    32  ### Call API
    33  
    34  Call the API with X-From-User header. Change the user to see the effects of sharding.
    35  
    36  ```shell
    37  curl  -H "X-From-User: john" http://localhost:8080/greeter/say/hello?name=John
    38  ```
    39