Convert to IceGrid/IceRegistry

in Help Center
Hi there,
I am relatively new in using Ice and currently using Ice3.3.0 on Windows .Net/C#.
My project was started with a simple Ice application on a standalone server using IceApplication. As time goes by, more and more clients are going to connect to this server to get served and so I had installed another server with the same copy of Ice service and then MANUALLY allocate what clients to use which server as primary and which is backup. And now, I have totally 8 servers with more than 40 clients. Since all servers are identical and the purpose of them is to balance the loading and in case of failure, a backup server can help. It sounds like a IceGrid is a better approach. Do I need to rewrite the Ice application to IceGrid? Or there is a few steps to convert it?
Thanks
Alex
I am relatively new in using Ice and currently using Ice3.3.0 on Windows .Net/C#.
My project was started with a simple Ice application on a standalone server using IceApplication. As time goes by, more and more clients are going to connect to this server to get served and so I had installed another server with the same copy of Ice service and then MANUALLY allocate what clients to use which server as primary and which is backup. And now, I have totally 8 servers with more than 40 clients. Since all servers are identical and the purpose of them is to balance the loading and in case of failure, a backup server can help. It sounds like a IceGrid is a better approach. Do I need to rewrite the Ice application to IceGrid? Or there is a few steps to convert it?
Thanks
Alex
0
Comments
Other than that, using IceGrid only requires you to set the locator (Ice.Default.Locator property) and make sure that the server uses the correct adapter configuration (<adapter>.AdapterId and <adapter>.Endpoints properties.)
Have a look at the IceGrid chapter in the manual for more detail.
You may also find the article Teach Yourself IceGrid in 10 Minutes useful to get started.
Cheers,
Michi.
I tried to use IceGridRegistry and it works nice but I have an issue to resolve.
Thanks
Alex
Setup:
Use Hello sample as the server with the following config files
[Config.Registry]
# The IceGrid locator proxy.
#
Ice.Default.Locator=IceGrid/Locator:tcp -p 12000
#
# IceGrid registry configuration.
#
IceGrid.Registry.Client.Endpoints=tcp -p 12000
IceGrid.Registry.Server.Endpoints=tcp
IceGrid.Registry.Internal.Endpoints=tcp
IceGrid.Registry.Data=db/registry
IceGrid.Registry.DynamicRegistration=1
[Config.Server]
Ice.Default.Locator=IceGrid/Locator:tcp -p 12000
Hello.Endpoints=tcp:udp:ssl
Hello.AdapterId=HelloAdapter
[Config.Client]
Ice.Default.Locator=IceGrid/Locator:tcp -p 12000
[email protected]
I have 2 machines to run the server (machineA and machineB) and 2 clients (clientX and clientY) and the registry is running on machineA.
1) ClientX is connecting to machineA and clientY is connecting to machineB and they "sayhello" perfectly. But now, I stop the server on machineA but keep the registry running on machineA, how clientX can be automatically failover to connect to machineB?
2) Now, I start another clientZ but it can't connect to any server (but I expect that it can connect to machineB because it is still running). I got the error below but I the location service is still running!
[ 4/15/2009 16:22:07:105 client.exe: Locator: searching for adapter by id
adapter = HelloAdapter ]
[ 4/15/2009 16:22:07:230 client.exe: Locator: adapter not found
adapter = HelloAdapter ]
[ 4/15/2009 16:22:07:230 client.exe: Locator: searching for adapter by id
adapter = HelloAdapter ]
[ 4/15/2009 16:22:07:230 client.exe: Locator: adapter not found
adapter = HelloAdapter ]
client.exe:
Ice.NotRegisteredException
kindOfObject = "object adapter"
id = "HelloAdapter"
at IceInternal.ProxyFactory.checkRetryAfterException(LocalException ex, Refer
ence ref, OutgoingAsync outAsync, Int32& cnt) in d:\builds\distbuilds\release\Ic
e-3.3.0\cs\src\Ice\ProxyFactory.cs:line 196
at Ice.ObjectPrxHelperBase.handleException__(ObjectDel_ delegate, LocalExcept
ion ex, OutgoingAsync outAsync, Int32& cnt) in d:\builds\distbuilds\release\Ice-
3.3.0\cs\src\Ice\Proxy.cs:line 880
at Ice.ObjectPrxHelperBase.ice_isA(String id__, Dictionary`2 context__, Boole
an explicitContext__) in d:\builds\distbuilds\release\Ice-3.3.0\cs\src\Ice\Proxy
.cs:line 168
at Ice.ObjectPrxHelperBase.ice_isA(String id__) in d:\builds\distbuilds\relea
se\Ice-3.3.0\cs\src\Ice\Proxy.cs:line 139
at Demo.HelloPrxHelper.checkedCast(ObjectPrx b) in C:\Ice-3.3.0-VC90\democs\I
ce\hello\generated\Hello.cs:line 605
at Client.App.run(String[] args) in C:\Ice-3.3.0-VC90\democs\Ice\hello\Client
.cs:line 63
at Ice.Application.mainInternal(String[] args, InitializationData initializat
ionData) in d:\builds\distbuilds\release\Ice-3.3.0\cs\src\Ice\Application.cs:lin
e 325
Caused by: Ice.AdapterNotFoundException
at IceInternal.LocatorInfo.getEndpointsException(Reference ref, Exception exc
) in d:\builds\distbuilds\release\Ice-3.3.0\cs\src\Ice\LocatorInfo.cs:line 433"
- Your Ice.Default.Locator property does not specify a host (using the -h option). As a result, a client running on machine A can only find a registry running on machine A, but not on machine B. That's because, without -h, the run time only looks on localhost for the locator.
- If you have two object adapters with the same name, you must set up a replica group. That's because adapter names must be unique per registry.
Have a look at Object Adapter Replication in the manual. It gives you the run-down on how to set up a replica group.Cheers,
Michi.
Thank you for your reply.
I have added -h in the Ice.Default.Locator property.
Is it possible to use the object adapter replication by IceGridRegistry but not IceGrid?
Thanks
Alex
You can achieve something similar without IceGrid by putting multiple endpoints for different adapters in different servers into your proxies. Such proxies then won't be indirectly bound (that is, must contain host and port). If you have multiple endpoints in a proxy, clients will fail over to another endpoint if an endpoint becomes non-functional. But you cannot control load-balancing policies that way, and you cannot change the physical endpoints of servers (or add or remove servers) without having to reconfigure and restart clients.
Cheers,
Michi.