how to set target server using load balancing?

Not applicable

In the TargetEndpoint, how to use TargetServer load balancing to configure the target endpoint................................

0 11 3,454
11 REPLIES 11

Not applicable

@Himanshu Tripathi

Please find the below way you can configure Target Server using load Balancer.

PS: You can include various algorithm and properties based on your use case.

Server Name as "ABC" need to define in environment configuration

 <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="ABC"/>
        </LoadBalancer>
        <Path>/v1/xyz/zbc</Path>
        </Properties>
</HTTPTargetConnection>

thanks @Umanng Goel

but when I am applying the above code I am getting this error

"Target TargetEndpoint-1 has invalid server reference abc."


Also please mention how to define the path that you mentioned

"<Path>/v1/xyz/zbc</Path>"

and please tell me if I want to route to a taget endpoint using using load balancing ,what condition should I give?

This error suggests that you haven't created the TargetServer.

You can do this in the UI by clicking APIs -> Environment Configuration -> (Select Environment) -> Target Servers.

Alternatively, you can use the Management API directly: http://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/environments/%7Benv_name%7D...

@Sean Davis Thanks

@Himanshu Tripathi

#when I am applying the above code I am getting this error--

You need to create the TargetServer first which u can do it either through UI or via managment API.

#Please mention how to define the path that you mentioned--

It depend on your backend URL whats the basepath and URI it have.

#Please tell me if I want to route to a taget endpoint using using load balancing--

Routing to different target endpoint can be done via routing rules define in ProxyEndpoint Default rule.

The first thing is you need to create different Target endpoint.

@Umanng Goel Thanks

Not applicable

@Umanng Goel The attached screenshots are an example I did.

Hope it will be helpful to you.

first you need to setup the target server in the environment configuration, from there you could define the host name and port for your target server.

then in your HTTPTargetConnection, you could setup the server to the target server you defined, and setup the Path to the uri you want to reach.

4376-screen-shot-2017-02-23-at-104832-pm.png

4377-screen-shot-2017-02-23-at-105117-pm.png

Not applicable

I agree with @Zheng Yang

1. You need to create a Target Server by UI or APIs.

2. Then config a TargetEndpoint to load balance by using Target Server's name.

3. set load balance options.

Is there a posibility of me passing server Name as a variable? 

Not to my knowledge. Is there a reason why routerules/conditions wouldn't suffice?

We would like to choose the loadbalance url based on a condition and keep multiple urls on a kvm. 

<HTTPTargetConnection>
<Properties/>
<LoadBalancer>
<Server name={Variable here}/>
</LoadBalancer>
</HTTPTargetConnection>