这里写了个小demo:
假如我们有很多店铺信息,每个店铺都有一个ShopID, 所以我们就把同一店铺的信息放在以ShopID命名的文件夹下,当一台服务器放不下时,我们就部署多台,这样每台服务器存储的店铺是不一样的。这些服务器就构成了一个服务器群。出于需要,我们要把这个群复制多个,部署在不同的地区(注重,各个群的信息是相同的)。为了完成这个目的,我们先设计了数据模型 MServerGroup(服务器群信息),MServer(服务器群下的服务器信息),MServerShop(服务器对应的店铺):
/// <summary>
/// 服务器群信息
/// </summary>
/// <remarks>
/// 用于存放点播文件服务器群的信息,比如主站的,北京站的,上海站的;各个站的数据相同.
/// 服务器群的目的是分散数据库的压力.
/// 目前只有主站的.
/// </remarks>
[Serializable()]
public class MServerGroup : BaseModelEntity
{
#region private
private int _ServerGroupID;
private string _ServerGroupName;
private MServerCollection _Servers;
#endregion
#region constructor
/// <summary>
/// 服务器群信息
/// </summary>
public MServerGroup()
{
}
/// <summary>
/// 服务器群信息
/// </summary>
/// <param name="_ServerGroupID">服务器群ID</param>
/// <param name="_ServerGroupName">服务器群名称</param>
public MServerGroup(int _ServerGroupID, string _ServerGroupName)
{
this._ServerGroupID = _ServerGroupID;
this._ServerGroupName = _ServerGroupName;
}
#endregion
#region property
/// <summary>
/// 服务器群ID
/// </summary>
public int ServerGroupID
{
get
{
return _ServerGroupID;
}
set
{
this._ServerGroupID = value;
}
}
/// <summary>
/// 服务器群名称
/// </summary>
public string ServerGroupName
{
get
{
return _ServerGroupName;
}
set
{
this._ServerGroupName = value;
}
}
/// <summary>
/// 服务器群下的服务器集合
/// </summary>
public MServerCollection Servers
{
get
{
评论加载中…
![]() |