Setting Dedicated Load Balancer URLs for Anypoint Datagraph | MuleSoft Documentation
# Setting Dedicated Load Balancer URLs for Anypoint Datagraph
If you’re unable to use Port 8082 on a CloudHub shared load balancer, you must set a URL for Anypoint DataGraph to use on a dedicated load balancer (DLB).
To set the URL, add a DLB mapping rule to the Anypoint DataGraph configuration.
## Example Mapping Rules for a DLB URL
Based on the way DLB mapping rules work, you must configure the **Input Path** (Input URI) and the **Output Path** (App URI) so that the final DLB URL is able to access the endpoint of the Anypoint DataGraph application, which is `/graphql`.
For example, consider the following mapping rules for `examplelb.lb.anypointdns.net` depending on the value of the **Input Path** and a Datagraph app name of `datagraph-xz082edx-1585-901xe374-d0x0`:
Index | Input URI (Input Path) | App name | App URI (Output Path) | Protocol  
---|---|---|---|---  
`datagraph-xz082edx-1585-901xe374-d0x0`  
`/datagraph/` | `datagraph-xz082edx-1585-901xe374-d0x0`  
`/datagraph/` | `datagraph-xz082edx-1585-901xe374-d0x0`  
For each index, the appropriate DLB URL is:
  * Index 0: `examplelb.lb.anypointdns.net/graphql`
  * Index 1: `examplelb.lb.anypointdns.net/datagraph/`
  * Index 2: `examplelb.lb.anypointdns.net/datagraph/graphql`
  * Index 3: `examplelb.lb.anypointdns.net/datagraph-xz082edx-1585-901xe374-d0x0/graphql`


## Prerequisites
  * You must have the Admin or Operator permission for the environment in which you want to specify a DLB URL.
  * You must be able to authenticate to and run commands from the Anypoint CLI.
  * You must be familiar with creating DLB mapping rules.
  * You must create and configure a DLB.


To complete this task, you:
  1. Use the Anypoint CLI to gather details about your DLB and Anypoint DataGraph.
  2. Use Anypoint Runtime Manager to create a mapping rule for the DLB.
  3. Use the Anypoint CLI to add the DLB configuration to Anypoint DataGraph.


## Gather Details about the DLB and Anypoint DataGraph
Gather the name of your DLB and the app name for Anypoint DataGraph.
  1. Connect to the Anypoint CLI using your Anypoint Platform username and password.
  2. If you did not previously set the environment, do so with the following command:
     * Using Anypoint CLI v3.x:
`use environment <environment name>`
     * Using Anypoint CLI v4.x:
`conf environment <environment name>`
  3. Get the name of the DLB:
     * Using Anypoint CLI v3.x:
`cloudhub load-balancer describe <dlb name>`
     * Using Anypoint CLI v4.x:
`cloudhub:load-balancer:describe <dlb name>`
The expected output resembles:
`Name | examplelb`
  4. Get the CloudHub domain for the Anypoint DataGraph app name:
     * Using Anypoint CLI v3.x:
`datagraph load-balancer-config describe`
     * Using Anypoint CLI v4.x:
`datagraph:load-balancer-config:describe`
The expected value resembles:
`Domain | datagraph-xz082edx-1585-901xe374-d0x0`
The DataGraph app name contains elements from your org ID and the environment ID.
  5. Note the values for steps 3 and 4.


## Create a Mapping Rule for the DLB
You set up the mapping rule in Runtime Manager.
  1. From Anypoint Platform, select **Runtime Manager**.
  2. From the navigation menu, select **Load Balancers**.
  3. Click a load balancer name, and then click a certificate name.
Ensure your load balancer has a valid, CA-signed certificate, or the browser won’t connect to Anypoint DataGraph.
  4. In the **URL Mapping Rules** section, click **Add New Rule**.
  5. Complete the fields with the following values:
     * **Input Path** (`inputUri`): The URI that the client requests: for example, `/{app}/`
     * **Target App** (`appName`): The domain for the Anypoint DataGraph application discovered in Step 4 of the gathering details task
     * **Output Path** (`appURI`): The URI string to pass to Anypoint DataGraph; for example `/` or `/graphql`
     * **Protocol** (`upstreamProtocol`): https
Anypoint DataGraph supports only HTTPS.


## Add the DLB Configuration to Anypoint DataGraph
After you add the mapping rule, you configure the DLB for use with Anypoint Datagraph.
  1. Check the DLB URL for Anypoint DataGraph:
     * Using Anypoint CLI v3.x:
```
datagraph load-balancer-config describe
```

     * Using Anypoint CLI v4.x:
```
datagraph:load-balancer-config:describe
```

By default, no value is returned for `dlbUrl` if you haven’t previously configured a DLB for that Anypoint DataGraph environment.
  2. Add the new DLB URL:
     * Using Anypoint CLI v3.x:
```
datagraph load-balancer-config add <url>
```

     * Using Anypoint CLI v4.x:
```
datagraph:load-balancer-config:add <url>
```

Replace `<url>` with a valid URL that includes the DLB name and DataGraph app name (gathered in Steps 3 and 4 of the gathering details task) and the mapping rule **Input Path** , for example:
     * Using Anypoint CLI v3.x:
```
datagraph load-balancer-config add examplelb.lb.anypointdns.net/datagraph/graphql
```

     * Using Anypoint CLI v4.x:
```
datagraph:load-balancer-config:add examplelb.lb.anypointdns.net/datagraph/graphql
```

Refer to Example Mapping Rules for a DLB URL if needed.
  3. Validate that the value was updated:
     * Using Anypoint CLI v3.x:
```
datagraph load-balancer-config describe
```

     * Using Anypoint CLI v4.x:
```
datagraph:load-balancer-config:describe
```

The CLI returns details that include the application name for the Anypoint DataGraph load balancer and the full domain name for the DLB.


After you add this change, Anypoint DataGraph re-deploys, and you must wait for the status indicator to indicate that Anypoint DataGraph is up to date.
## Remove the DLB Configuration from Anypoint DataGraph
You can remove the DLB configuration using the following command:
  * Using Anypoint CLI v3.x:
```
datagraph load-balancer-config remove
```

  * Using Anypoint CLI v4.x:
```
datagraph:load-balancer-config:remove
```

When you remove the configuration, Anypoint DataGraph redeploys.


## Additional Resources
  * Anypoint DataGraph Hosting Options and Networking
  * Add an API Schema to the Unified Schema
  *