Showing posts with label Servers. Show all posts
Showing posts with label Servers. Show all posts

Wednesday, November 7, 2012

Configuring and using display picture in Exchange Server 2010


The process involved in uploading display pictures to the AD users and how to use this new functionality using Outlook 2010.
 
 

Introduction

This article is all about Thumbnailphoto attribute, we are going to upload users’ image files to that attribute and then the new applications like Outlook 2010 and future UC applications will be able to use that information to display the user picture.
Before starting the process to configure and test, we need to check a few requirements, as follows:
  • The ThumbnailPhoto attribute is limited to 102400 bytes which means 10KB. This limit is defined in the RangeUpper value of the attribute.
  • The file format is JPG
  • Keep in mind that information is going to Active Directory which means it may affect replication and also NTDS database size

Configuring Global Catalog

The first step of the process is to configure the replication of the attribute to the Global Catalog. The process is pretty straight forward and you can repeat these following steps:
  1. Logged on a Domain Controller
  2. Click on Start, Run and type in regsrv32 schmmgmt.dll and click OK, as shown in Figure 01

Figure 01
  1. A dialog box saying “DllRegisterServer in schmmgmt.dll succeeded” will show up. Just click on OK.
Now that we have the Active Directory Schema registered we need to open it to configure the replication of the attribute. You can repeat these following steps to enable the replication, as follows:
  1. Logged on the same session where you have just executed the previous steps
  2. Click on Start, Run and type mmc and click on OK
  3. Click on File menu item and then click on Add/Remove Snap-ins…
  4. Click on Active Directory Schema on the Available snap-ins section, and then click on Add > button, as shown in the Figure 02. Click OK.

Figure 02
  1. Expand Active Directory Schema [<Your-Server-Name>] item
  2. Click on Attributes
  3. Look for thumbnailPhoto attribute and double click on it
  4. Check the option Replicate this attribute to the Global Catalog and click on OK, as shown in Figure 03.

Figure 03
That’s all we need from Active Directory, now it is time to upload the image files to the users’ thumbnailphoto attribute and start testing it.

Importing display pictures to the Active Directory Users

The cmdlet used to import users’ pictures to Active Directory is the Import-RecipientDataProperty. This cmdlet can be used to import image or audio to the users. In this article we will cover just the image portion of this cmdlet. The syntax to use is described below and requires only two pieces of information from the administrator: Mailbox name and the path of the picture.
Import-RecipientDataProperty -Identity <Mailbox> -Picture -FileData ([Byte[]]$(Get-Content -path <Picture Path > -Encoding Byte -ReadCount 0))
The process to import a picture (C:\Photos\Anderson.jpg in the example) to another user (Anderson in the example) can be seen in the Figure 04.

Figure 04
An easy way to validate the procedure that we have just done is to check the thumbnailphoto attribute on that previous user and if it is not empty then we know that the user’s display picture was uploaded. In Figure 05 we are using the Active Directory Users and Computer of a Windows Server 2008 which has the Attribute Editor page to check the information out.
If you have Windows Server 2003 you can install Support Tools and then check the attribute out using ADSIEdit.msc. If you have Windows Server 2008 or higher and you can’t see the Attribute Editor tab, then click on View and then Advanced Features, after that try to check the properties of the user again.

Figure 05

Testing what we have done so far

Okay, attribute is configured to replicate and we have just uploaded a picture to a user. Now, it’s time to test! Outlook 2010 uses a lot the user’s picture and we will be able to see it all over the place, a couple of examples where you will notice the display pictures:
  • Global Address List dialog box
  • Outlook initial page (clicking on Office button) as shown in Figure 06
  • Reading pane
  • Contact card (Figure 07)
  • Meeting Requests

Figure 06
Figure 07

Creating a script to facilitate the upload process

In order to facilitate the process to upload images for one or more users I created a simple script to do that work. The script can be changed to meet your requirements, feel free to change it and if you add any new improvement, please let me know :). The script does some tests, such as path validation and image size.
Before using the scripts let us go over a few key points about its functionalities:
  • The script is based on the JPG file names. The username and file name must match, for example: Anderson (mailbox) and anderson.jpg (file) will work fine
  • The default folder that script uses to locate the JPG files is the C:\Photos. You can change that just by editing the Script and changing the $DefaultPhotoPath variable
  • If all pre-requisites are not met , the script will exit without doing any operation in Active Directory
  • Run the script through Exchange Management Shell
Okay, let us test the script for a single user. First of all, let us make sure that we have a JPG with the name of the user on the default folder (C:\Photos). And let’s run the following syntax:
.\UploadPhoto.ps1 <mailbox-name>
After testing path and size of the picture, the script will upload the file to Active Directory, as show in Figure 08

Figure 08
I also created a –all switch for the script, where the script will list all JPG files of the default folder and, based on the file name, it will upload it to the Active Directory user. In the Figure 09, I ran the script and I had two files (anderson.jpg and Lidiana.jpg) alongside the users anderson and lidiana respectively, were updated.

Figure 09
Finally, here is a copy of the script demonstrated above:
param([Switch]$all, [String]$UserName)
#Default Values. Change them based on your environment.
$DefaultPhotoPath = 'C:\Photos' 
Function CheckPhoto(){
 Write-Warning "Validating file(s).." 
 Write-Host "File exists... " -nonewline
 If (Test-Path $PhotoPath) 
 {
 Write-Host "[OK]" -ForeGroundColor Green
 Write-host "Photo size... " -nonewline
 $PhotoSize = Get-ChildItem $PhotoPath | select Length
 If ($PhotoSize.Length -le 10000) { Write-Host "[OK]" -ForeGroundColor Green } Else { Write-Host "[Fail]" -ForeGroundColor Red; exit }
 }
 Else
 {
 Write-Host "[Fail]" -ForeGroundColor Red
 Exit
 }
}
Function UploadAll(){
 ForEach ($TempFile in Get-ChildItem $DefaultPhotoPath | Where-Object { $_.Extension -eq ".jpg" } )
 {
  $TempUserName = $TempFile.Name.substring(0, $TempFile.Name.Length - 4)
  Write-Host $TempUserName -ForeGroundColor Yellow -NoNewLine
  Import-RecipientDataProperty -Identity $TempUserName -Picture -FileData ([Byte[]]$(Get-Content -path $TempFile.Fullname -Encoding Byte -ReadCount 0))
  Write-Host "[Done]" -ForeGroundColor Green
 }
}
If ( $all -eq $true) 
 { 
 Write-Warning " ## This action will upload all pictures of C:\Photos to the AD users."
 Write-Warning " ## All pictures must have the same name of the usernames" 
 Write-Warning "Are you sure that you want upload all pictures to the users (Y/N)?" 
 $Opt = Read-Host 
 If ( $Opt -eq 'y' ) { UploadAll; } Else { Write-Host "No changes were made."; Exit }
 }
Else
 {
 $PhotoPath = $DefaultPhotoPaty + $UserName + '.jpg'
 CheckPhoto;
 If ( $AbortMission -eq '$true' ) { Write-Error "Please, review the errors and try again." } Else { Import-RecipientDataProperty -Identity $UserName -Picture -FileData ([Byte[]]$(Get-Content -path $PhotoPath -Encoding Byte -ReadCount 0)) } 
 }

How to manipulate pictures using C#

If you do not want to use a script or a cmdlet to play with the thumbnailphoto attribute, you always can create your own application to do that. There is a Microsoft KB entitled How to Manipulate the ThumbNailPhoto Attribute of a User Object in the Active Directory and it can be found at this address http://support.microsoft.com/kb/292029. On this specific KB there is a sample of C# application that allows manipulation of that attribute.

How to remove the current picture?

Well, we have been working a lot to upload images to Active Directory but in some point of the process you will be asked to remove it, right? There are, in fact, a couple of easy ways to remove the display picture from a user object.
The first one that you may be thinking is to go the user’s properties and clear the value of ThumbnailPhoto and it will work just fine.
The first one is okay however we have a second option that is more elegant, we can use Set-Mailbox with –RemovePicture switch, the syntax is shown below:
Set-Mailbox <Mailbox> -RemovePicture

Conclusion

advertisement

In this article we went over the process of how to configure and send photos to the end-users. The script is just a start point. You can be adapting that script to your needs or creating your own script to allow end-users to update their own personal images.
An example of the usage of that script has allowed end-users to save their own photo to a shared folder (they can just copy and paste to a shared folder, or a web application that allows them to upload their display picture) and then use a task scheduler task or something like that to run the uploadphotos.ps1 –all to update the display image to the Active Directory.
More information:
ThumbnailPhoto attribute by MSDN

Linux下双机HA的功能实现

——基于heartbeat方式
clip_image001
HeartBeat
运行于备用主机上的Heartbeat可以通过以太网连接检测主服务器的运行状态,一旦其无法检测到主服务器的“心跳”则自动接管主服务器的资源。通常情况下,主、备服务器间的心跳连接是一个独立的物理连接,这个连接可以是串行线缆、一个由“交叉线”实现的以太网连接。Heartbeat甚至可同时通过多个物理连接检测主服务器的工作状态,而其只要能通过其中一个连接收到主服务器处于活动状态的信息,就会认为主服务器处于正常状态。从实践经验的角度来说,建议为Heartbeat配置多条独立的物理连接,以避免Heartbeat通信线路本身存在单点故障。
1、串行电缆:被认为是比以太网连接安全性稍好些的连接方式,因为hacker无法通过串行连接运行诸如telnet、ssh或rsh类的程序,从而可以降低其通过已劫持的服务器再次侵入备份服务器的几率。但串行线缆受限于可用长度,因此主、备服务器的距离必须非常短。
2、以太网连接:使用此方式可以消除串行线缆的在长度方面限制,并且可以通过此连接在主备服务器间同步文件系统,从而减少了从正常通信连接带宽的占用。
基于冗余的角度考虑,应该在主、备服务器使用两个物理连接传输heartbeat的控制信息;这样可以避免在一个网络或线缆故障时导致两个节点同时认为自已是唯一处于活动状态的服务器从而出现争用资源的情况,这种争用资源的场景即是所谓的“脑裂”(split-brain)或“partitioned cluster”。在两个节点共享同一个物理设备资源的情况下,脑裂会产生相当可怕的后果。
为了避免出现脑裂,可采用下面的预防措施:
1、如前所述,在主、备节点间建立一个冗余的、可靠的物理连接来同时传送控制信息;
2、一旦发生脑裂时,借助额外设备强制性地关闭其中一个节点;
第二种方式即是俗称的“将其它节点‘爆头’(shoot the other node in the head)”,简称为STONITH。基于能够通过软件指令关闭某节点特殊的硬件设备,Heartbeat即可实现可配置的Stonith。但当主、备服务器是基于WAN进行通信时,则很难避免“脑裂”情景的出现。因此,当构建异地“容灾”的应用时,应尽量避免主、备节点共享物理资源。
Heartbeat的控制信息:
“心跳”信息: (也称为状态信息)仅150 bytes大小的广播、组播或多播数据包。可为以每个节点配置其向其它节点通报“心跳”信息的频率,以及其它节点上的heartbeat进程为了确认主节点出节点出现了运行等错误之前的等待时间。
集群变动事务(transition)信息:ip-request和ip-request-rest是相对较常见的两种集群变动信息,它们在节点间需要进行资源迁移时为不同节点上heartbeat进程间会话传递信息。比如,当修复了主节点并且使其重新“上线”后,主节点会使用ip-request要求备用节点释放其此前从因主节点故障而从主节点那里接管的资源。此时,备用节点则关闭服务并使用ip-request-resp通知主节点其已经不再占用此前接管的资源。主接点收到ip-request-resp后就会重新启动服务。
重传请求:在某集群节点发现其从其它节点接收到的heartbeat控制信息“失序”(heartbeat进程使用序列号来确保数据包在传输过程中没有被丢弃或出现错误)时,会要求对方重新传送此控制信息。 Heartbeat一般每一秒发送一次重传请求,以避免洪泛。
上面三种控制信息均基于UDP协议进行传送,可以在/etc/ha.d/ha.cf中指定其使用的UDP端口或者多播地址(使用以太网连接的情况下)。
此外,除了使用“序列号/确认”机制来确保控制信息的可靠传输外,Heartbeat还会使用MD5或SHA1为每个数据包进行签名以确保传输中的控制信息的安全性。
资源脚本:
资源脚本(resource scripts)即Heartbeat控制下的脚本。这些脚本可以添加或移除IP别名(IP alias)或从属IP地址(secondary IP address),或者包含了可以启动/停止服务能力之外数据包的处理功能等。通常,Heartbeat会到/etc/init.d/或/etc/ha.d/resource.d/目录中读取脚本文件。Heartbeat需要一直明确了解“资源”归哪个节点拥有或由哪个节点提供。在编写一个脚本来启动或停止某个资源时,一定在要脚本中明确判断出相关服务是否由当前系统所提供。
Heartbeat的配置文件:
/etc/ha.d/ha.cf
定义位于不同节点上的heartbeat进程间如何进行通信;
1.3.1 配置ha.cf文件
ha.cf是heartbeat的主要配置文件,可以对heartbeat的多数性能和状态进行配置。大部分选项的取值可以采用默认值,其中的主要选项及配置方法说明如下:
debugfile /var/log/ha-debug:该文件保存heartbeat的调试信息
logfile /var/log/ha-log:heartbeat的日志文件
keepalive 2:心跳的时间间隔,默认时间单位为秒
deadtime 30:超出该时间间隔未收到对方节点的心跳,则认为对方已经死亡。
warntime 10:超出该时间间隔未收到对方节点的心跳,则发出警告并记录到日志中。
initdead 120:在某些系统上,系统启动或重启之后需要经过一段时间网络才能正常工作,该选项用于解决这种情况产生的时间间隔。取值至少为deadtime的两倍。
udpport 694:设置广播通信使用的端口,694为默认使用的端口号。
baud 19200:设置串行通信的波特率。
serial /dev/ttyS0:选择串行通信设备,用于双机使用串口线连接的情况。如果双机使用以太网连接,则应该关闭该选项。
bcast eth0:设置广播通信所使用的网络接口卡。
auto_failback on:heartbeat的两台主机分别为主节点和从节点。主节点在正常情况下占用资源并运行所有的服务,遇到故障时把资源交给从节点并由从节点运行服务。在该选项设为on的情况下,一旦主节点恢复运行,则自动获取资源并取代从节点,否则不取代从节点。
ping ping-node1 ping-node2:指定ping node,ping node并不构成双机节点,它们仅仅用来测试网络连接。
respawn hacluster /usr/lib/heartbeat/ipfail:指定与heartbeat一同启动和关闭的进程,该进程被自动监视,遇到故障则重新启动。最常用的进程是ipfail,该进程用于检测和处理网络故障,需要配合ping语句指定的ping node来检测网络连接。
/etc/ha.d/haresources
定义对某个资源来说哪个服务器是主节点,以及哪个节点应该拥有客户端访问资源时的目标IP地址。
authkeys文件用于heartbeat的鉴权设置,共有三种可用的鉴权方式:crc、md5和sha1。三种方式安全性依次提高,但同时占用的系统资源也依次扩大。crc安全性最低,适用于物理上比较安全的网络,sha1提供最为有效的鉴权方式,占用的系统资源也最多。
其配置语句格式如下:
auth <number>
<number> <authmethod> [<authkey>]
举例说明:
auth 1
1 sha1 key-for-sha1
其中键值key-for-sha1可以任意指定,number设置必须保证上下一致。
auth 2
2 crc
crc方式不需要指定键值。
/etc/ha.d/authkeys
定义Heartbeat包在通信过程中如何进行加密。
当ha.cf或authkeys文件发生改变时,需要重新加载它们就可以使用之生效;而如果haresource文件发生了改变,则只能重启heartbeat服务方可使之生效。
尽管Heartbeat并不要求主从节点间进行时钟同步,但它们彼此间的时间差距不能超过1分钟,否则一些配置为高可用的服务可能会出异常。
Heartbeat当前也不监控其所控制的资源的状态,比如它们是否正在运行,是否运行良好以及是否可供客户端访问等。要想监控这些资源,冉要使用额外的Mon软件包来实现。
haresources配置文件介绍:
主从节点上的/etc/ra.d/raresource文件必须完全相同。文件每行通常包含以下组成部分:
1、服务器名字:指正常情况下资源运行的那个节点(即主节点),后跟一个空格或tab;这里指定的名字必须跟某个节点上的命令"uname -n"的返回值相同;
2、IP别名(即额外的IP地址,可选):在启动资源之前添加至系统的附加IP地址,后跟空格或tab;IP地址后面通常会跟一个子网掩码和广播地址,彼此间用“/”隔开;
3、资源脚本:即用来启动或停止资源的脚本,位于/etc/init.d/或/etc/ha.d/resourcd.d目录中;如果需要传递参数给资源脚本,脚本和参数之间需要用两个冒号分隔,多个参数时彼此间也需要用两个冒号分隔;如果有多个资源脚本,彼此间也需要使用空格隔开;
haresources文件用于指定双机系统的主节点、集群IP、子网掩码、广播地址以及启动的服务等。其配置语句格式如下:
node-name network-config <resource-group>
其中node-name指定双机系统的主节点,取值必须匹配ha.cf文件中node选项设置的主机名中的一个,node选项设置的另一个主机名成为从节点。
network-config用于网络设置,包括指定集群IP、子网掩码、广播地址等。resource-group用于设置heartbeat启动的服务,该服务最终由双机系统通过集群IP对外提供。
格式如下:
primary-server [IPaddress[/mask/interface/broadcast]] resource1[::arg1::arg2] resource2[::arg1::arg2]
例如:
primary-server 221.67.132.195 sendmail httpd
HA的LVS集群有两台Director,在启动时,主节点占有集群负载均衡资源(VIP和LVS的转发及高度规则),备用节点监听主节点的“心跳”信息并在主节点出现异常时进行“故障转移”而取得资源使用权,这包括如下步骤:
1、添加VIP至其网络接口;
2、广播GARP信息,通知网络内的其它主机目前本Director其占有VIP;
3、创建IPVS表以实现入站请求连接的负载均衡;
4、Stonith;
弃用resource脚本,改用ldirecotord来控制LVS:
ldirectord用来实现LVS负载均衡资源的在主、备节点间的故障转移。在首次启动时,ldirectord可以自动创建IPVS表。此外,它还可以监控各Realserver的运行状态,一旦发现某Realserver运行异常时,还可以将其从IPVS表中移除。
ldirectord进程通过向Realserver的RIP发送资源访问请求并通过由Realserver返回的响应信息来确定Realserver的运行状态。在Director上,每一个VIP需要一个单独的ldirector进程。如果Realserver不能正常响应Directord上ldirectord的请求,ldirectord进程将通过ipvsadm命令将此Realserver从IPVS表中移除。而一旦Realserver再次上线,ldirectord会使用正确的ipvsadm命令将其信息重新添加至IPVS表中。
例如,为了监控一组提供web服务的Realserver,ldirectord进程使用HTTP协议请求访问每台Realserver上的某个特定网页。ldirectord进程根据自己的配置文件中事先定义了的Realserver的正常响应结果来判断当前的返回结果是否正常。比如,在每台web服务器的网站目录中存放一个页面".ldirector.html",其内容为"GOOD",ldirectord进程每隔一段时间就访问一次此网页,并根据获取到的响应信息来判断Realserver的运行状态是否正常。如果其返回的信息不是"GOOD",则表明服务不正常。
ldirectord需要从/etc/ha.d/目录中读取配置文件,文件名可以任意,但建议最好见名知义。
实现过程:
创建/etc/ha.d/ldirectord-192.168.0.219.cf,添加如下内容:
# Global Directives
checktimeout=20
# ldirectord等待Realserver健康检查完成的时间,单位为秒;
# 任何原因的检查错误或超过此时间限制,ldirector将会将此Realserver从IPVS表中移除;
checkinterval=5
# 每次检查的时间间隔,即检查的频率;
autoreload=yes
# 此项用来定义ldirectord是否定期每隔一段时间检查此配置文件是否发生改变并自动重新加载此文件;
logfile="/var/log/ldirectord.log"
# 定义日志文件存放位置;
quiescent=yes
# 当某台Realserver出现异常,此项可将其设置为静默状态(即其权重为“0”)从而不再响应客户端的访问请求;
# For an http virtual service
virtual=192.168.0.219:80
# 此项用来定义LVS服务及其使用的VIP和PORT
real=192.168.0.221:80 gate 100
# 定义Realserver,语法:real=RIP:port gate|masq|ipip [weight]
real=192.168.0.223:80 gate 300
fallback=127.0.0.1:80 gate
# 当IPVS表没有任何可用的Realserver时,此“地址:端口”作为最后响应的服务;
# 一般指向127.0.0.1,并可以通过一个包含错误信息的页面通知用户服务发生了异常;
service=http
# 定义基于什么服务来测试Realserver;
request=".ldirectord.html"
receive="GOOD"
scheduler=wlc
#persistent=600
#netmask=255.255.255.255
protocol=tcp
# 定义此虚拟服务用到的协议;
checktype=negotiate
# ldirectord进程用于监控Realserver的方法;{negotiate|connect|A number|off}
checkport=80
在/etc/hd.d/haresources中添加类似如下行:
node1.example.com 192.168.0.219 ldirectord::ldirectord-192.168.0.219.cf

Heartbeat

运行于备用主机上的Heartbeat可以通过以太网连接检测主服务器的运行状态,一旦其无法检测到主服务器的“心跳”则自动接管主服务器的资源。通常情况下,主、备服务器间的心跳连接是一个独立的物理连接,这个连接可以是串行线缆、一个由“交叉线”实现的以太网连接。Heartbeat甚至可同时通过多个物理连接检测主服务器的工作状态,而其只要能通过其中一个连接收到主服务器处于活动状态的信息,就会认为主服务器处于正常状态。从实践经验的角度来说,建议为Heartbeat配置多条独立的物理连接,以避免Heartbeat通信线路本身存在单点故障。
1、串行电缆:被认为是比以太网连接安全性稍好些的连接方式,因为hacker无法通过串行连接运行诸如telnetsshrsh类的程序,从而可以降低其通过已劫持的服务器再次侵入备份服务器的几率。但串行线缆受限于可用长度,因此主、备服务器的距离必须非常短。
2、以太网连接:使用此方式可以消除串行线缆的在长度方面限制,并且可以通过此连接在主备服务器间同步文件系统,从而减少了从正常通信连接带宽的占用。
基于冗余的角度考虑,应该在主、备服务器使用两个物理连接传输heartbeat的控制信息;这样可以避免在一个网络或线缆故障时导致两个节点同时认为自已是唯一处于活动状态的服务器从而出现争用资源的情况,这种争用资源的场景即是所谓的“脑裂”(split-brain)或“partitioned cluster”。在两个节点共享同一个物理设备资源的情况下,脑裂会产生相当可怕的后果。
为了避免出现脑裂,可采用下面的预防措施:
1、如前所述,在主、备节点间建立一个冗余的、可靠的物理连接来同时传送控制信息;
2、如前所述,在主、备节点间建立一个冗余的、可靠的物理连接来同时传送控制信息;
3、一旦发生脑裂时,借助额外设备强制性地关闭其中一个节点;
第二种方式即是俗称的“将其它节点‘爆头’(shoot the other node in the head)”,简称为STONITH。基于能够通过软件指令关闭某节点特殊的硬件设备,Heartbeat即可实现可配置的Stonith。但当主、备服务器是基于WAN进行通信时,则很难避免“脑裂”情景的出现。因此,当构建异地“容灾”的应用时,应尽量避免主、备节点共享物理资源。
Heartbeat的控制信息:
“心跳”信息: (也称为状态信息)仅150 bytes大小的广播、组播或多播数据包。可为以每个节点配置其向其它节点通报“心跳”信息的频率,以及其它节点上的heartbeat进程为了确认主节点出节点出现了运行等错误之前的等待时间。
集群变动事务(transition)信息:ip-requestip-request-rest是相对较常见的两种集群变动信息,它们在节点间需要进行资源迁移时为不同节点上heartbeat进程间会话传递信息。比如,当修复了主节点并且使其重新“上线”后,主节点会使用ip-request要求备用节点释放其此前从因主节点故障而从主节点那里接管的资源。此时,备用节点则关闭服务并使用ip-request-resp通知主节点其已经不再占用此前接管的资源。主接点收到ip-request-resp后就会重新启动服务。
重传请求:在某集群节点发现其从其它节点接收到的heartbeat控制信息“失序”(heartbeat进程使用序列号来确保数据包在传输过程中没有被丢弃或出现错误)时,会要求对方重新传送此控制信息。 Heartbeat一般每一秒发送一次重传请求,以避免洪泛。
上面三种控制信息均基于UDP协议进行传送,可以在/etc/ha.d/ha.cf中指定其使用的UDP端口或者多播地址(使用以太网连接的情况下)。
此外,除了使用“序列号/确认”机制来确保控制信息的可靠传输外,Heartbeat还会使用MD5SHA1为每个数据包进行签名以确保传输中的控制信息的安全性。
资源脚本(resource scripts)即Heartbeat控制下的脚本。这些脚本可以添加或移除IP别名(IP alias)或从属IP地址(secondary IP address),或者包含了可以启动/停止服务能力之外数据包的处理功能等。通常,Heartbeat会到/etc/init.d//etc/ha.d/resource.d/目录中读取脚本文件。Heartbeat需要一直明确了解“资源”归哪个节点拥有或由哪个节点提供。在编写一个脚本来启动或停止某个资源时,一定在要脚本中明确判断出相关服务是否由当前系统所提供。

Installing Failover Clustering With Windows Server 2008 R2

Introduction
Creating a Cluster with Windows Server 2003 was a little bit confusing for administrators. Now with Windows Server 2008, its much easier. In this article I will be showing you how to setup a cluster with two nodes using Windows Server 2008 R2 Failover Clustering feature.

Creating a failover clustering means you have at least two servers connected to a shared storage.


Failover Clustering System Requirement:

  • Windows Server 2008/R2 : Failover Clustering feature is available with Windows Server 2008/R2 Enterprise/Data Center editions. You don't have this feature with the Standard edition of Windows Server 2008/R2.
  • Domain role: All servers in the cluster must be in the same Active Directory domain.
  • DNS: The servers in the cluster must be using Domain Name System (DNS) for name resolution.
  • Account for administering the cluster : When you create a cluster or add servers to it, you must be logged on to the domain with an account that has administrator rights on all servers in that cluster ( if the account is not a Domain Admins account, the account must be given the Create Computer Objects and Read All Properties permissions in the domain ).
  • Servers : Two identical servers in brand, model and configurations.
  • Device Controllers ( HBA ) : i/SCSI or Fiber , both also to be the identical.
  • Storage : You must use shared storage that is compatible with Windows Server 2008 R2.


Now that you know the requirement for Failover Clustering, lets start:

Configuration on Server A

  1. To install Failover feature, open Server Manager, click on Start > Administrative Tools > Server Manager

  2. Expand Features, and then click on Add Feature.



    The list of available features will be listed, select the Failover Clustering and click on Next



    Click Install



  3. The Failover Clustering feature will be installed. Click Close



Configuration on Server B


  1. Again on Server B, we will need to install Failover Clustering feature as well, so click on Start > All Programs > Administrative Tools > Server Manager



    Click on Features and then click on Add Features



  2. Choose the Failover Clustering feature and click Next



  3. Confirm installing Failover Clustering by clicking on Install


    Close the Add Features Wizard once installation is completed.


Now that both servers have Failover Clustering feature installed on them, we can create the cluster on one of these server and join the other one to the cluster.

Now, we need to open and configure our cluster name, IP and nodes.

To open Failover Clustering, click on Start > Administrative Tools > Failover Cluster Manager

>> This needs to be done on a single server only <<




  1. The first step in creating a successful failover clustering, is by validating the existing systems and shared storage. This is done by the option Validate a Configuration



    When you click on Validate a Configuration, you will need to browse and add the Cluster nodes, these are the servers that will be part of the cluster, then click Next



    Choose to Run all tests and click Next



    The available tests will be displayed in the confirmation window, click Next to begin validating your cluster






    Review the validation report, as your configuration might have few issues with it and needs to be addresses before setting up your cluster.



  2. Now that the configuration is validated and you are ready to setup your cluster. Click on the second option, Create a Cluster, the wizard will launch, read it and then click Next



  3. You need to add the names of the servers you want to have in the cluster. You can start creating your cluster with a single server and then add other nodes in the future.

    Browse to your servers and then once all the servers ( nodes ) are listed, click Next



  4. After the servers are selected, you need to type a name and IP for your Cluster



  5. On the Confirmation window, review your settings. The following will be displayed in this window: cluster name and IP address, selected servers name. If all info is proper, then click Next. Else click Previous and correct which setting needs to be adjusted.



    After you click Next, creating the cluster will begin.

  6. The summary windows will be displayed after a successful setup of the cluster.



  7. Open Failover Cluster Manager and you will see your nodes and setting inside the MMC. Here you can configure your cluster, add new nodes, remove nodes, add more disk storage and so on.




Summary

In this article, I have created a two node cluster using Failover Clustering feature which is available with Windows Server 2008 R2 Enterprise and Data Center editions.
Installing Exchange 2010 Step-by-Step
With our handy guide, you'll have Exchange 2010 installed and running on top of Windows Server 2008 R2 in no time.

This is the second part of a two part series on Microsoft Exchange 2010. In the first article we examined the changes and enhancements in Exchange 2010. This time we'll walk through the steps required to install a fully functional Exchange 2010 server on Windows Server 2008 R2.

System Requirements

First, you need to make sure that your Active Directory (AD) environment and your Exchange server meet the minimum requirements:
  • AD forest functional level is Windows Server 2003 (or higher)
  • AD Schema Master is running Windows Server 2003 w/SP1 or later
  • Full installation of Windows Server 2008 w/SP2 or later OR Windows Server 2008 R2 for the Exchange server itself
  • Exchange server is joined to the domain (except for the Edge Transport server role)

Prerequisites

In this example we are going to install Exchange 2010 on a Windows Server 2008 R2 operating system. Before installing Exchange we need to install some Windows components. It's important that you don't miss anything here because the Exchange 2010 installer does not provide very good feedback if Server 2008 R2 is missing required components.
  1. Install the 2007 Office System Converter: Microsoft Filter Pack
  2. Add the appropriate Windows components/features
    1. Open PowerShell via the icon on the task bar or Start >> All Programs >> Accessories >> Windows PowerShell >> Windows PowerShell. Be sure that PowerShell opened with an account that has rights to install Windows components/features.
    2. Run the following command: Import-Module ServerManager
    3. For a typical install with the Client Access, Hub Transport, and Mailbox roles run the following command: Add-WindowsFeature NET-Framework,RSAT-ADDS,Web-Server,Web-Basic-Auth,Web-Windows-Auth,Web-Metabase,Web-Net-Ext,Web-Lgcy-Mgmt-Console,WAS-Process-Model,RSAT-Web-Server,Web-ISAPI-Ext,Web-Digest-Auth,Web-Dyn-Compression,NET-HTTP-Activation,RPC-Over-HTTP-Proxy -Restart. For a full matrix of the required Windows components with regards to the Exchange server roles see: http://technet.microsoft.com/en-us/library/bb691354.aspx#WS08R2
  • If your Exchange server will have the Client Access Server role set the Net.Tcp Port Sharing Service to start automatically
    1. Open PowerShell via the icon on the task bar or Start >> All Programs >> Accessories >> Windows PowerShell >> Windows PowerShell. Be sure that PowerShell opened with an account that has rights to modify service startup settings.
    2. Run the following command: Set-Service NetTcpPortSharing -StartupType Automatic
  • Setting up Microsoft Exchange 2010

    Exchange 2010 Installation

    Now we're ready to run the Exchange 2010 installer. We'll go through a typical installation that includes the Client Access, Hub Transport, and Mailbox roles. This is what you will want to install if you are only going to be running one Exchange server. If you scale out your Exchange architecture with multiple servers then you will want to familiarize yourself with the Exchange server roles for a proper deployment.
    1. Logon to the desktop of your soon to be Exchange server with a Domain Admin account.
    2. Run setup from the Exchange 2010 media.
    3. Click on "Step 3: Choose Exchange language option" and choose one of the options (Install only languages from the DVD will be fine in most cases).
    4. Click on "Step 4: Install Microsoft Exchange."
    5. Click Next at the Introduction page.
    6. Accept the license terms and click Next.
    7. Make a selection on the Error Reporting page and click Next.
    8. Stick with the default "Typical Exchange Server Installation" and click Next.
    9. Choose a name for your Exchange Organization and click Next.
    10. Make a selection on the Client Settings page and click Next.
    11. If you want your Exchange server to be available externally then choose a domain name such as mail.myorganization.com, click Next.
    12. Make a selection on the Customer Experience Improvement Program page and click Next.
    13. If all the prerequisites are there then you can click Install.
    14. Grab a cup of coffee or take a walk while the installation process does its thing.
    15. When the installation has finished go back to the Exchange installation page click on "Step 5: Get critical updates for Microsoft Exchange."
    16. Install Microsoft Update (if necessary) so that Windows update will check for non-OS updates, and verify that there are no Exchange updates.

    Post Installation Steps

    Now that you have Exchange 2010 installed, you will need to do some basic configuration in the Exchange Management console to get mail flowing to/from your server.
    1. Open the Exchange Management Console via Start >> All Programs >> Microsoft Exchange Server 2010 >> Exchange Management Console
    2. Expand Microsoft Exchange On-Premises so you can see: Organization Configuration, Server Configuration, Recipient Configuration, and Toolbox
    3. Under Organization Configuration >> Hub Transport >> Accepted Domains add a new Accepted Domain for the domain you wish to use for email addresses. For example, your AD domain will be listed by default (i.e. ad.myorganization.com). You will probably want to add "myorganization.com" as an Authoritative Domain.
    4. Under Organization Configuration >> Hub Transport >> Send Connectors >> New Send Connector ... >> Pick a name such as "MyOrganization Internet Send Connector" >> change the drop down to "Internet" >> Next >> Add ... >> enter "*" in the Address field and check the box to include all subdomains >> OK >> Next. Now, if you want your Exchange server to route mail directly, then click Next on the Network setting page, but if you want to route your email through an upstream provider then select "Route mail through the following smart hosts" and Add ... a mail gateway such as smtp.comcast.net. Click Next >> Next >> Next >> New
    5. Under Server Configuration >> Hub Transport >> Right-click Default *** >> Properties >> Permission Groups tab, check the box for Anonymous users. This will allow your Exchange server to accept incoming mail delivery from remote mail servers.
    6. Under Recipient Configuration >> Mailbox, create mailboxes for your existing AD users (or create a new user & mailbox)
      1. New Mailbox ... >> select User Mailbox >> Next >> Existing users >> Add ... >> select an existing AD account >> OK >> Next >> specify an alias (e.g. the AD user name) >> Next >> New
    7. If you want to use an SSL certificate for Outlook Web App, IMAP, POP, etc. click on Server Configuration and import or create the certificate

    Mail Routing Configuration

    Now the final piece you need to configure to receive mail is your external DNS records. The method for configuring your DNS records will depend on whether you host your own DNS or have a provider that hosts it for you. Either way you will need to create an "A" record that points mail.myorganization.com to the IP address of your mail server, and an "MX" record that points myorganization.com to mail.myorganization.com. You will also want to make sure that port 25 is open both inbound and outbound to your Exchange server.

    Conclusion

    That's it! You should now be able to browse to https://mail.myorganization.com/owa (or https://localhost/owa from the server) and logon via the Web interface to send and receive mail!