ice grid 第一篇

本文深入介绍了ICE框架中的核心组件——ice registry,如何管理server和object adapters,以及well-known objects的概念和使用。通过配置文件、XML描述和icegridadmin工具,展示了如何在ICE网格中创建和管理应用实例,包括服务器启动、节点增加和对象查找。此外,还讨论了replica groups和负载均衡策略。
摘要由CSDN通过智能技术生成


关键点:

(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管理工具,我

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值