关键点:
(1)如果想提高并发的话,还是在一个node上对于同一个application开多个server instance.
1.名词解释
。Replica groups
A replica group is the term for a collection of replicated object adapters. An
application can create any number of replica groups. Each group requires a
unique identifier.
• Nodes
An application must assign its servers to one or more nodes.
• Servers
A server’s description includes a unique name and the path to its executable. It
also lists the object adapters it creates.
• Object adapters
Information about an object adapter includes its endpoints and any wellknown
objects it advertises. If the object adapter is a member of a replica
group, it must also supply that group’s identifier.
• Objects
A well-known object is one that is known solely by its identity. The registry
maintains a global list of such objects for use during locate requests.
IceGrid uses the term descriptor to refer to the description of an application
代理
直接代理;:对象 和 地址 。例如,代理: SimplePrinter:default -p 10000
间接代理:两种。第一种仅仅包含well-known objects(众所周知对象),例如代理 SimplePrinter 就是对象SimplePrinter的代理。第二种包含对象和对象适配器标识,例如,SimplePrinter@PrinterAdapter
2.一个简单的ice架构(ice registry只提供定位服务)
(1)客户端代码:
Ice::ObjectPrx proxy =
communicator->stringToProxy("factory@EncoderAdapter");//第一步是定位服务,通过括号内的"对象@对象适配器id"找到了代理
Ripper::MP3EncoderFactoryPrx factory =
Ripper::MP3EncoderFactoryPrx::checkedCast(proxy); //第二步是使用代理得到想要的远端对象。是对远端对象的第一次调用
Ripper::MP3EncoderPrx encoder = factory->createEncoder();
(2)配置文件
registry 配置:
/opt/ripper/registry.cfg contains the following properties:(前五个必选)
IceGrid.InstanceName=inputtest //如果不写。默认是IceGrid
IceGrid.Registry.Client.Endpoints=tcp -p 4061
IceGrid.Registry.Server.Endpoints=tcp
IceGrid.Registry.Internal.Endpoints=tcp
IceGrid.Registry.Data=/opt/ripper/registry
IceGrid.Registry.DynamicRegistration=1
IceGrid.Registry.AdminPermissionsVerifier=IceGrid/NullPermissionsV
erifier
IceGrid.Registry.AdminCryptPasswords=../etc/passwd //这个选项倒是很有意思,可以设置操作admin的权限
client配置文件:
Ice.Default.Locator=IceGrid/Locator:tcp -h registryhost -p 4061 (在没有写IceGrid的名字的情况下)
server配置,opt/ripper/server.cfg
EncoderAdapter.AdapterId=EncoderAdapter (对象适配器id)
EncoderAdapter.Endpoints=tcp //不写端口地址,表明系统自动分配端口
Ice.Default.Locator=IceGrid/Locator:tcp -h registryhost -p 4061
(3)启动
启动registry
icegridregistry --Ice.Config=/opt/ripper/registry.cfg
启动server
/opt/ripper/bin/server --Ice.Config=/opt/ripper/server.cfg
3 使用ice registry来管理server(xml和node)
3.1 使用xml文件描述server,使用node
为了使用icegridadmin管理工具,我