一种服务器集群简单通信的方法及系统技术方案

技术编号:15520423 阅读:74 留言:0更新日期:2017-06-04 09:59
本发明专利技术公开了一种服务器集群简单通信的方法及系统,属于服务器通信技术领域。本发明专利技术的服务器集群简单通信的方法,所述通信的方法以集群中的一个服务器作为主机server,其他服务器作为从机client,用ssh安全登录从机client执行任务,任务完成后从机client发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。该发明专利技术的服务器集群简单通信的方法及系统操作简单有效,不需要额外安装特殊软件,不需要额外配置控制服务器,减少成本,提高生产效率,具有很好的推广应用价值。

Method and system for simple communication of server cluster

The invention discloses a method and a system for simple communication of a server cluster, belonging to the field of server communication technology. Simple communication method cluster server of the invention, the method of communication with a server in the cluster as the host server, the other from the server as client, to perform tasks from client SSH login security, after the completion of the task from the client to the main machine sending task state machine server, server according to the client sent from the host machine the task of the state, is sent from the client task. Method and system for simple communication of the server cluster has the advantages of simple operation, no need to install special software that does not require additional configuration control server, reduce cost, improve production efficiency, has the very good application value.

【技术实现步骤摘要】
一种服务器集群简单通信的方法及系统
本专利技术涉及服务器通信
,具体提供一种服务器集群简单通信的方法及系统。
技术介绍
计算机具有存储信息量大,使用者获取信息方便快捷等优点,受到广泛的应用。特别是近年来随着社会及经济的进一步发展,计算机的水平有了质的提高。服务器相对于普通计算机来说,在稳定性、安全性等方面的要求更高,在质量与处理器数据性能上更出色,广泛应用到各个大型企业。在实际生产测试和部署过程中,常常需要服务器集群同步执行任务(例如安装软件等)。服务器集群同步执行任务时需要服务器集群进行通信,服务器集群进行通信时的安全问题成为关键。但是现有技术中,还没有能够保证服务器集群间进行通信时安全性的有效方法。ssh为secureshell的缩写,由IEIT的网络小组(NetworkWorkingGroup)所定制。ssh为建立在应用层和传输层基础上的安全协议。ssh是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用ssh协议可以有效防止远程管理过程中的信息泄露问题。ssh最初是UNIX系统上的一个程序,后来又迅速扩展到其他操作平台,ssh在正确使用时可弥补网络中的漏洞。本专利技术中利用ssh解决服务器集群同步执行任务时的安全性问题。
技术实现思路
本专利技术的技术任务是针对上述存在的问题,提供一种操作简单有效,不需要额外安装特殊软件,不需要额外配置控制服务器,减少成本,提高生产效率的服务器集群简单通信的方法。本专利技术进一步的技术任务是提供一种能实现上述服务器集群简单通信方法的系统。为实现上述目的,本专利技术提供了如下技术方案:一种服务器集群简单通信的方法,所述通信的方法以集群中的一个服务器作为主机server,其他服务器作为从机client,用ssh安全登录从机client执行任务,任务完成后从机client发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。作为优选,所述服务器集群简单通信的方法具体包括以下步骤:S1:在主机server和从机client上安装操作OS;S2:配置主机server和从机client的IP地址;S3:设置ssh无密码访问;S4:配置主机server和从机client名;S5:主机server和从机client间相通信。步骤S1中根据实际需求安装需要的操作系统,本专利技术中以Redhat6.4为例。步骤S2中以如下脚本来配置IP(以主机server为例)。cat>/etc/sysconfig/network-scripts/ifcfg-eth0<<EOFDEVICE=eth0ONBOOT=yesBOOTPROTO=staticTYPE=EthernetIPADDR=192.168.1.1NETMASK=255.255.255.0EOF/sbin/servicenetworkrestart为了方便,主机serverIP设置为192.168.1.1。步骤S4中,以主机server为例:修改/etc/hosts文件Vim/etc/hosts一般文件内容如下:127.0.0.1localhost.localdomainlocalhost我们在下面添加如下内容:192.168.1.1m01192.168.1.2m02192.168.1.3m03根据自己的实际情况把所有从机client添加进hosts文件,把hosts文件拷贝替换所有服务器/etc/hosts,工作完成后登录其他服务器就可以直接执行:sshm01。作为优选,步骤S3中,在client上产生一对密钥,执行ssh-keygen命令,需要输入的地方直接回车,输出如下:[user@Client.ssh]$ssh-keygen-dGeneratingpublic/privatedsakeypair.Enterfileinwhichtosavethekey(/home/user/.ssh/id_dsa):Enterpassphrase(emptyfornopassphrase):Entersamepassphraseagain:Youridentificationhasbeensavedin/home/user/.ssh/id_dsa.Yourpublickeyhasbeensavedin/home/user/.ssh/id_dsa.pub.Thekeyfingerprintis:22:0c:2e:64:09:2e:a9:f1:37:c5:ee:d9:e5:57:92:b4user@Client此时,在/home/user/.ssh目录下,存有一对密钥id_dsa和id_dsa.pub。当公钥id_dsa.pub以任何方式上传到server上,如:[user@Client.ssh]$scpid_dsa.pubServer:/home/user登录到server上,执行以下命令catid_dsa.pub>>/home/user/.ssh/authorized_keys,这样就完成了配置,此时由从机client登录主机server,无需输入密码。作为优选,步骤S5中主机server和从机client间为双向通信。在clientm02/opt目录下编写最简单的测试脚本scripts.sh内容如下:#!/bin/bashsleep2sshm01“touch/opt/m02”这个脚本的含义是,延迟2秒,登录server服务器在/opt目录下新建名为m02的文件。在主机server服务器运行如下命令行sshm02“ssh/opt/scritps.sh”如果运行成功在/opt/目录下会发现新建的文件m02,完成一个通信循环。一种服务器集群简单通信的系统,包括多个服务器,其中一个服务器为主机server,其他服务器为从机client,采用ssh安全登录从机client执行任务,从机client完成任务后发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。作为优选,所述主机server与从机client间为双向通信。与现有技术相比,本专利技术的服务器集群简单通信的方法具有以下突出的有益效果:本专利技术的服务器集群简单通信的方法操作简单,不需要额外安装特殊软件,不需要额外配置控制服务器,减少成本,提高生产效率,并能解决服务器集群同步执行任务时的安全性问题。附图说明图1是本专利技术所述服务器集群简单通信的系统的示意图。具体实施方式下面将结合附图和实施例,对本专利技术的服务器集群简单通信的方法及系统作进一步详细说明。实施例本专利技术的服务器集群简单通信的方法,以集群中的一个服务器作为主机server,其他服务器作为从机client,用ssh安全登录从机client执行任务,任务完成后从机client发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。该服务器集群简单通信的方法具体包括以下步骤:S1:在主机server和从机client上安装操作OS,根据实际需求安装需要的操作系统,本专利技术中以Redhat6.4为例。S2:配置主机server和从机clien本文档来自技高网...
一种服务器集群简单通信的方法及系统

【技术保护点】
一种服务器集群简单通信的方法,其特征在于:所述通信的方法以集群中的一个服务器作为主机server,其他服务器作为从机client,用ssh安全登录从机client执行任务,任务完成后从机client发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。

【技术特征摘要】
1.一种服务器集群简单通信的方法,其特征在于:所述通信的方法以集群中的一个服务器作为主机server,其他服务器作为从机client,用ssh安全登录从机client执行任务,任务完成后从机client发送任务状态到主机server,主机server根据从机client发送的任务状态,为从机client发送新任务。2.根据权利要求1所述的服务器集群简单通信的方法,其特征在于:所述服务器集群简单通信的方法具体包括以下步骤:S1:在主机server和从机client上安装操作OS;S2:配置主机server和从机client的IP地址;S3:设置SSH无密码访问;S4:配置主机server和从机client名;S5:主机server和从机client间相通信。3.根据权利...

【专利技术属性】
技术研发人员:肖峰镇
申请(专利权)人:郑州云海信息技术有限公司
类型:发明
国别省市:河南,41

网友询问留言 已有0条评论
  • 还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。

1