github.com/pachyderm/pachyderm@v1.13.4/doc/docs/master/deploy-manage/manage/cluster-access.md (about)

     1  # Manage Cluster Access
     2  
     3  Pachyderm contexts enable you to store configuration parameters for
     4  multiple Pachyderm clusters in a single configuration file saved at
     5  `~/.pachyderm/config.json`. This file stores the information
     6  about all Pachyderm clusters that you have deployed from your
     7  machine locally or on a remote server.
     8  
     9  For example, if you have a cluster that
    10  is deployed locally in `minikube` and another one deployed on
    11  Amazon EKS, configurations for these clusters are stored in
    12  that `config.json` file. By default, all local cluster configurations
    13  have the `local` prefix. If you have multiple local clusters,
    14  Pachyderm adds a consecutive number to the `local` prefix
    15  of each cluster.
    16  
    17  The following text is an example of a Pachyderm `config.json` file:
    18  
    19  ```shell
    20  {
    21     "user_id": "b4fe4317-be21-4836-824f-6661c68b8fba",
    22     "v2": {
    23       "active_context": "local-1",
    24       "contexts": {
    25         "default": {},
    26         "local": {},
    27         "local-1": {},
    28       },
    29       "metrics": true
    30     }
    31  }
    32  ```
    33  
    34  ## View the Active Context
    35  
    36  When you have multiple Pachyderm clusters, you can switch
    37  between them by setting the current context.
    38  The active context is the cluster that you interact with when
    39  you run `pachctl` commands.
    40  
    41  To view active context, type:
    42  
    43  * View the active context:
    44  
    45    ```shell
    46    pachctl config get active-context
    47    ```
    48  
    49    **System response:**
    50  
    51    ```shell
    52    local-1
    53    ```
    54  
    55  * List all contexts and view the current context:
    56  
    57    ```shell
    58    pachctl config list context
    59    ```
    60  
    61    **System response:**
    62  
    63    ```shell
    64      ACTIVE  NAME
    65              default
    66              local
    67      *       local-1
    68    ```
    69  
    70    The active context is marked with an asterisk.
    71  
    72  ## Change the Active Context
    73  
    74  To change the active context, type `pachctl config set
    75  active-context <name>`.
    76  
    77  Also, you can set the `PACH_CONTEXT` environmental variable
    78  that overrides the active context.
    79  
    80  **Example:**
    81  
    82  ```shell
    83  export PACH_CONTEXT=local1
    84  ```
    85  
    86  ## Create a New Context
    87  
    88  When you deploy a new Pachyderm cluster, a new context
    89  that points to the new cluster is created automatically.
    90  
    91  In addition, you can create a new context by providing your parameters
    92  through the standard input stream (`stdin`) in your terminal.
    93  Specify the parameters as a comma-separated list enclosed in
    94  curly brackets.
    95  
    96  !!! note
    97      By default, the `pachd` port is `30650`.
    98  
    99  To create a new context with specific parameters, complete
   100  the following steps:
   101  
   102  1. Create a new Pachyderm context with a specific `pachd` IP address
   103  and a client certificate:
   104  
   105     ```shell
   106     echo '{"pachd_address":"10.10.10.130:650", "server_cas":"key.pem"}' | pachctl config set context new-local
   107     ```
   108  
   109     **System response:**
   110  
   111     ```shell
   112     Reading from stdin
   113     ```
   114  
   115  1. Verify your configuration by running the following command:
   116  
   117     ```shell
   118     pachctl config get context new-local
   119     {
   120       "pachd_address": "10.10.10.130:650",
   121       "server_cas": "key.pem"
   122     }
   123     ```
   124  
   125  ## Update an Existing Context
   126  
   127  You can update an existing context with new parameters, such
   128  as a Pachyderm IP address, certificate authority (CA), and others.
   129  For the list of parameters, see [Pachyderm Config Specification](../../reference/config_spec.md).
   130  
   131  To update the Active Context, run the following commands:
   132  
   133  1. Update the context with a new `pachd` address:
   134  
   135     ```shell
   136     pachctl config update context local-1 --pachd-address 10.10.10.131
   137     ```
   138  
   139     The `pachctl config update` command supports the `--pachd-address`
   140     flag only.
   141  
   142  1. Verify that the context has been updated:
   143  
   144     ```shell
   145     pachctl config get context local-1
   146     ```
   147  
   148     **System response:**
   149  
   150     ```shell
   151     {
   152       "pachd_address": "10.10.10.131"
   153     }
   154     ```
   155  
   156  1. Alternatively, you can update multiple properties by using
   157  an `echo` script:
   158  
   159     ```shell
   160     echo '{"pachd_address":"10.10.10.132", "server_cas":"key.pem"}' | pachctl config set context local-1 --overwrite
   161     ```
   162  
   163     **System response:**
   164  
   165     ```shell
   166     Reading from stdin.
   167     ```
   168  
   169  1. Verify that the changes were applied:
   170  
   171     ```shell
   172     pachctl config get context local-1
   173     ```
   174  
   175     **System response:**
   176  
   177     ```shell
   178     {
   179       "pachd_address": "10.10.10.132",
   180       "server_cas": "key.pem"
   181     }
   182     ```