[go: up one dir, main page]

CN105487943A - Method for automatically copying files to each node of cluster server - Google Patents

Method for automatically copying files to each node of cluster server Download PDF

Info

Publication number
CN105487943A
CN105487943A CN201510905816.3A CN201510905816A CN105487943A CN 105487943 A CN105487943 A CN 105487943A CN 201510905816 A CN201510905816 A CN 201510905816A CN 105487943 A CN105487943 A CN 105487943A
Authority
CN
China
Prior art keywords
node
cluster server
configuration
copying files
password
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510905816.3A
Other languages
Chinese (zh)
Inventor
王野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IEIT Systems Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201510905816.3A priority Critical patent/CN105487943A/en
Publication of CN105487943A publication Critical patent/CN105487943A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种自动向集群服务器各节点拷贝文件的方法,属于向集群服务器各节点拷贝文件的领域,本发明要解决的技术问题为向集群服务器各节点拷贝文件效率低,采用的技术方案步骤为:(1)通过shell脚本设置配置文档信息,配置完档信息包括各节点ip地址、用户名和密码;(2)执行shell脚本并调用except工具,通过scp命令输入文档路径、本地源文件路径和远程主机目标文件路径;(3)shell脚本自动执行,获取配置文档信息,执行拷贝;(4)显示执行过程。

The invention discloses a method for automatically copying files to each node of a cluster server, which belongs to the field of copying files to each node of a cluster server. The technical problem to be solved by the invention is that the efficiency of copying files to each node of a cluster server is low, and the technical solution adopted The steps are: (1) Set the configuration document information through the shell script. After configuration, the document information includes the IP address, user name and password of each node; (2) Execute the shell script and call the except tool, and input the document path and local source file path through the scp command and the target file path of the remote host; (3) The shell script is automatically executed to obtain the configuration file information and execute the copy; (4) Display the execution process.

Description

一种自动向集群服务器各节点拷贝文件的方法A method for automatically copying files to each node of a cluster server

技术领域 technical field

本发明涉及向集群服务器各节点拷贝文件的领域,具体地说是一种自动向集群服务器各节点拷贝文件的方法。 The invention relates to the field of copying files to each node of a cluster server, in particular to a method for automatically copying files to each node of a cluster server.

背景技术 Background technique

集群服务器节点比较多,测试过程中想向各节点拷贝一些文件或者脚本时,如果通过U盘或者手动输入scp命令一个一个节点的拷贝则需要进行用户名和密码输入等很多重复工作,耗费大量时间。如何实现只需选取一个节点,将待拷贝的文件和该脚本一起拷贝到该节点上,然后执行该脚本即可完成将文件拷贝到其他节点的操作是本发明要解决的技术问题。 There are many cluster server nodes. When you want to copy some files or scripts to each node during the test, if you use a USB flash drive or manually enter the scp command to copy the nodes one by one, you need to do a lot of repetitive work such as user name and password input, which takes a lot of time. How to realize the operation of copying files to other nodes by simply selecting a node, copying the file to be copied together with the script to the node, and then executing the script is the technical problem to be solved by the present invention.

发明内容 Contents of the invention

本发明的技术任务是针对以上不足,提供一种自动向集群服务器各节点拷贝文件的方法,来解决向集群服务器各节点拷贝文件效率低的问题。 The technical task of the present invention is to provide a method for automatically copying files to each node of the cluster server to solve the problem of low efficiency of copying files to each node of the cluster server.

本发明的技术任务是按以下方式实现的: Technical task of the present invention is realized in the following manner:

一种自动向集群服务器各节点拷贝文件的方法,步骤为: A method for automatically copying files to each node of a cluster server, the steps are:

(1)通过shell脚本设置配置文档信息,配置完档信息包括各节点ip地址、用户名和密码; (1) Set the configuration file information through the shell script. After configuration, the file information includes the IP address, user name and password of each node;

(2)执行shell脚本并调用except工具,通过scp命令输入文档路径、本地源文件路径和远程主机目标文件路径; (2) Execute the shell script and call the except tool, and input the document path, local source file path and remote host target file path through the scp command;

(3)shell脚本自动执行,获取配置文档信息,执行拷贝; (3) The shell script is automatically executed to obtain the configuration file information and execute the copy;

(4)显示执行过程。 (4) Display the execution process.

所述步骤(1)中设置配置文档信息时,各节点ip地址、用户名和密码的信息格式为: When setting the configuration document information in the step (1), the information format of the IP address, user name and password of each node is:

IPusernamepassword IP username password

ip地址与用户名之间以及用户名与密码之间通过空格或tab键分隔。 The ip address and user name and the user name and password are separated by spaces or tab keys.

所述步骤(2)中执行脚本时输入命令: Enter the command when executing the script in step (2):

./batch_scp.sh配置文档路径本地源文件路径远程主机目标文件路径。 ./batch_scp.sh configuration document path local source file path remote host target file path.

本发明的原理为:利用shell脚本提取配置文档里的节点ip地址、用户名和密码等信息,然后执行scp命令并调用expect工具来实现scp远程操作过程中自动输入节点的密码,免去人机交互过程。 The principle of the present invention is: use shell script to extract information such as node ip address, user name and password in the configuration file, then execute the scp command and call the expect tool to realize the automatic input of the node's password in the scp remote operation process, eliminating the need for human-computer interaction process.

本发明的一种自动向集群服务器各节点拷贝文件的方法具有以下优点:本发明采用shell脚本和expect工具实现自动向集群服务器各节点拷贝文件的操作,大大简化了操作流程,特别是对于没有相关经验的人员,使用该方法可以轻松完成拷贝任务。本方法在集群服务器的测试和使用阶段,可以很方便的完成大量的拷贝任务,节省时间提高效率。 A method for automatically copying files to each node of the cluster server of the present invention has the following advantages: the present invention adopts shell script and expect tool to realize the operation of automatically copying files to each node of the cluster server, which greatly simplifies the operation process, especially for those who do not have relevant Experienced personnel can easily complete the copying task by using this method. The method can conveniently complete a large number of copying tasks during the testing and use stages of the cluster server, saving time and improving efficiency.

附图说明 Description of drawings

下面结合附图对本发明进一步说明。 The present invention will be further described below in conjunction with the accompanying drawings.

附图1为实施例中shell脚本的流程示意图。 Accompanying drawing 1 is the schematic flow chart of shell script in the embodiment.

具体实施方式 detailed description

  参照说明书附图和具体实施例对本发明的一种自动向集群服务器各节点拷贝文件的方法作以下详细地说明。 A method for automatically copying files to each node of the cluster server according to the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

实施例: Example:

本发明的一种自动向集群服务器各节点拷贝文件的方法,步骤为: A method for automatically copying files to each node of the cluster server according to the present invention, the steps are:

(1)通过shell脚本设置配置文档信息,配置完档信息包括各节点ip地址、用户名和密码; (1) Set the configuration file information through the shell script. After configuration, the file information includes the IP address, user name and password of each node;

(2)执行shell脚本并调用except工具,通过scp命令输入文档路径、本地源文件路径和远程主机目标文件路径; (2) Execute the shell script and call the except tool, and input the document path, local source file path and remote host target file path through the scp command;

(3)shell脚本自动执行,获取配置文档信息,执行拷贝; (3) The shell script is automatically executed to obtain the configuration file information and execute the copy;

(4)显示执行过程。 (4) Display the execution process.

该shell脚本完成如下功能: The shell script completes the following functions:

(1)手动完成配置文档cfg.list (1) Manually complete the configuration file cfg.list

在配置文档cfg.list中指定远程主机ip、用户名和密码,这些信息需要写成以下的格式: Specify the remote host ip, user name and password in the configuration file cfg.list. These information need to be written in the following format:

IPusernamepassword IP username password

中间用空格或tab键来分隔,多台主机的信息需要写多行内容,如: The middle is separated by a space or a tab key, and the information of multiple hosts needs to be written in multiple lines, such as:

192.168.0.1root123456 192.168.0.1root123456

192.168.0.2userpassword 192.168.0.2userpassword

(2)执行脚本 (2) Execute the script

执行时按照以下方式输入命令就可以了: When executing, enter the command in the following way:

./batch_scp.sh配置文档路径本地源文件路径远程主机目标文件路径 ./batch_scp.sh configuration document path local source file path remote host target file path

例如: For example:

./batch_scp.sh./cfg.list/root/file/root/file ./batch_scp.sh ./cfg.list/root/file/root/file

(3)完成拷贝操作并显示到屏幕 (3) Complete the copy operation and display it on the screen

脚本执行过程中会有拷贝过程显示在屏幕上,可以根据显示查看到拷贝的文件信息。 During the execution of the script, the copy process will be displayed on the screen, and the copied file information can be viewed according to the display.

通过上面具体实施方式,所述技术领域的技术人员可容易的实现本发明。但是应当理解,本发明并不限于上述的具体实施方式。在公开的实施方式的基础上,所述技术领域的技术人员可任意组合不同的技术特征,从而实现不同的技术方案。除说明书所述的技术特征外,均为本专业技术人员的已知技术。 Through the above specific implementation manners, those skilled in the technical field can easily realize the present invention. However, it should be understood that the present invention is not limited to the specific embodiments described above. On the basis of the disclosed embodiments, those skilled in the art can arbitrarily combine different technical features to achieve different technical solutions. Except for the technical features described in the description, all are known technologies by those skilled in the art.

Claims (3)

1.一种自动向集群服务器各节点拷贝文件的方法,其特征在于步骤为: 1. A method for automatically copying files to each node of the cluster server, characterized in that the steps are: (1)通过shell脚本设置配置文档信息,配置完档信息包括各节点ip地址、用户名和密码; (1) Set the configuration file information through the shell script. After configuration, the file information includes the IP address, user name and password of each node; (2)执行shell脚本并调用except工具,通过scp命令输入文档路径、本地源文件路径和远程主机目标文件路径; (2) Execute the shell script and call the except tool, and input the document path, local source file path and remote host target file path through the scp command; (3)shell脚本自动执行,获取配置文档信息,执行拷贝; (3) The shell script is automatically executed to obtain the configuration file information and execute the copy; (4)显示执行过程。 (4) Display the execution process. 2.根据权利要求1所述的一种自动向集群服务器各节点拷贝文件的方法,其特征在于所述步骤(1)中设置配置文档信息时,各节点ip地址、用户名和密码的信息格式为: 2. A method for automatically copying files to each node of a cluster server according to claim 1, wherein when setting configuration document information in the step (1), the information format of each node ip address, user name and password is : IPusernamepassword IP username password ip地址与用户名之间以及用户名与密码之间通过空格或tab键分隔。 The ip address and user name and the user name and password are separated by spaces or tab keys. 3.根据权利要求1所述的一种自动向集群服务器各节点拷贝文件的方法,其特征在于所述步骤(2)中执行脚本时输入命令: 3. A method for automatically copying files to each node of the cluster server according to claim 1, wherein the command is input when executing the script in the step (2): ./batch_scp.sh配置文档路径本地源文件路径远程主机目标文件路径。 ./batch_scp.sh configuration document path local source file path remote host target file path.
CN201510905816.3A 2015-12-09 2015-12-09 Method for automatically copying files to each node of cluster server Pending CN105487943A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510905816.3A CN105487943A (en) 2015-12-09 2015-12-09 Method for automatically copying files to each node of cluster server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510905816.3A CN105487943A (en) 2015-12-09 2015-12-09 Method for automatically copying files to each node of cluster server

Publications (1)

Publication Number Publication Date
CN105487943A true CN105487943A (en) 2016-04-13

Family

ID=55674936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510905816.3A Pending CN105487943A (en) 2015-12-09 2015-12-09 Method for automatically copying files to each node of cluster server

Country Status (1)

Country Link
CN (1) CN105487943A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106789205A (en) * 2016-12-09 2017-05-31 广州视源电子科技股份有限公司 Cluster command operation method and system
CN106815132A (en) * 2017-01-13 2017-06-09 郑州云海信息技术有限公司 A kind of cluster server formation gathering method
CN107577468A (en) * 2017-07-25 2018-01-12 郑州云海信息技术有限公司 A kind of distance host login method and system with draw-bar box
CN107819869A (en) * 2017-11-21 2018-03-20 深圳竹云科技有限公司 A kind of method of linux unix files transmission mutual trust
WO2018126964A1 (en) * 2017-01-04 2018-07-12 中兴通讯股份有限公司 Task execution method and apparatus and server
CN110134546A (en) * 2019-04-11 2019-08-16 平安科技(深圳)有限公司 Batch restarts windows systems approach, electronic device and storage medium
CN110798336A (en) * 2019-09-25 2020-02-14 苏州浪潮智能科技有限公司 Method and device for environmental inspection of large data platform deployment server
CN112306962A (en) * 2019-07-26 2021-02-02 杭州海康威视数字技术股份有限公司 File copying method and device in computer cluster system and storage medium
CN114338655A (en) * 2022-03-10 2022-04-12 北京宇信科技集团股份有限公司 Remote server file transmission engine, transmission method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110225417A1 (en) * 2006-12-13 2011-09-15 Kavi Maharajh Digital rights management in a mobile environment
CN104519100A (en) * 2013-09-29 2015-04-15 重庆新媒农信科技有限公司 Method for automatic heterogeneous platform file synchronization and puppet server

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110225417A1 (en) * 2006-12-13 2011-09-15 Kavi Maharajh Digital rights management in a mobile environment
CN104519100A (en) * 2013-09-29 2015-04-15 重庆新媒农信科技有限公司 Method for automatic heterogeneous platform file synchronization and puppet server

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSDN: "scp远程拷贝expect实现SHELL", 《HTTPS://COCONUT-ZHANG.ITEYE.COM/BLOG/1894650》 *
CSDN: "ssh expect 批量ssh和scp", 《HTTPS://BLOG.CSDN.NET/CAOERYINGZI/ARTICLE/DETAILS/48242203》 *
CSDN: "批量执行linux环境下的SCP命令", 《HTTPS://BLOG.CSDN.NET/BLUETROPIC/ARTICLE/DETAILS/11963827》 *
脚本之家: "shell结合expect写的批量scp脚本工具", 《HTTPS://WWW.JB51.NET/ARTICLE/34005.HTM》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106789205A (en) * 2016-12-09 2017-05-31 广州视源电子科技股份有限公司 Cluster command operation method and system
WO2018126964A1 (en) * 2017-01-04 2018-07-12 中兴通讯股份有限公司 Task execution method and apparatus and server
CN106815132A (en) * 2017-01-13 2017-06-09 郑州云海信息技术有限公司 A kind of cluster server formation gathering method
CN107577468A (en) * 2017-07-25 2018-01-12 郑州云海信息技术有限公司 A kind of distance host login method and system with draw-bar box
CN107819869A (en) * 2017-11-21 2018-03-20 深圳竹云科技有限公司 A kind of method of linux unix files transmission mutual trust
CN110134546A (en) * 2019-04-11 2019-08-16 平安科技(深圳)有限公司 Batch restarts windows systems approach, electronic device and storage medium
CN112306962A (en) * 2019-07-26 2021-02-02 杭州海康威视数字技术股份有限公司 File copying method and device in computer cluster system and storage medium
CN112306962B (en) * 2019-07-26 2024-02-23 杭州海康威视数字技术股份有限公司 File copying method, device and storage medium in computer cluster system
CN110798336A (en) * 2019-09-25 2020-02-14 苏州浪潮智能科技有限公司 Method and device for environmental inspection of large data platform deployment server
CN114338655A (en) * 2022-03-10 2022-04-12 北京宇信科技集团股份有限公司 Remote server file transmission engine, transmission method and device

Similar Documents

Publication Publication Date Title
CN105487943A (en) Method for automatically copying files to each node of cluster server
US11086662B2 (en) Method and system of migrating applications to a cloud-computing environment
CN104035876B (en) Method for implementing LINPACK cluster test in IB network environment based on PXE, SHELL and EXPECT
JP6421249B2 (en) Method and computer system for supporting debugging
CN105094851A (en) Method for realizing code release at any time based on Git
CN106533719A (en) Method and system for realizing cluster deployment
TWI453673B (en) Concurrent exception handling
CN105162629A (en) Automatic implementation method for double-network-card binding under LINUX system
CN107728996A (en) A kind of GIT branch managements method and device
CN106254162B (en) Network-based Linux system in cluster calculate node operating system recovery method
CN110018866B (en) User interface theme updating method, device, system, vehicle and vehicle
CN108132881A (en) A kind of automated testing method and system
WO2018010385A1 (en) Method and system for processing multi-system screenshot files
JP2011028438A (en) Application verification system and computer program
CN103986665A (en) The method of network load balancing in Yunhai OS
WO2015196805A1 (en) Batch command execution method and apparatus
CN105183854A (en) Scheduling method applicable to data unloading of database
CN112988817A (en) Data comparison method, system, electronic equipment and storage medium
CN107273163A (en) A kind of parameter configuration management method and device based on graphic user interface
US20160259716A1 (en) Rebuilding an execution flow from an execution grid
CN114138285B (en) Application deployment method, computing device and readable storage medium
WO2018205390A1 (en) Control layout display control method, system, and apparatus, and computer readable storage medium
CN102830976B (en) A kind of software architecture dynamic evolution method based on incidence matrix
CN118409720A (en) Multi-screen display method, main display device and storage medium
CN111143227B (en) A data operation method, device, terminal and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160413

RJ01 Rejection of invention patent application after publication