首页 文章 精选 留言 我的

精选列表

搜索[一键安装包],共10011篇文章
优秀的个人博客,低调大师

【Python】从Jenkins下载最近一次成功构建的安装包

#-*- coding:utf-8 -*-from case.beatles.test_beatles import TestBeatlesfrom framework.logger import Loggerfrom page.ios.beatles.jenkins_page import Jenkins_Toolclass DownloadApp(TestBeatles): def testDownloadfromJenkins(self): try: jp = Jenkins_Tool() jp.download_app_from_jenkins()except Exception, e: Logger.error(e)self.save_screenshot()self.fail(e.message) #-*- coding:utf-8 -*-from datetime import datetimeimport urllibimport jenkinsimport os job_names = ['job-ios','job_android'] username = 'Jenkins用户名'password = 'Jenkins密码'base_ios_debug_download_url = 'https://xxx/ios/Debug/'base_android_debug_download_url = 'https://xxx/android/Debug/'ios_app_suffix = '.ipa'class Jenkins_Tool(): def __init__(self): self.jenkins_url = 'http://jenkins host url' self.sever = jenkins.Jenkins(self.jenkins_url, username=username, password=password)# 获取最新构建号 def get_build_number(self, job_name): lastest_completed_build_number = self.sever.get_job_info(job_name)['lastCompletedBuild']['number']# print(lastest_completed_build_number) return lastest_completed_build_number# 获取Jenkins下的所有job def get_all_jobs(self): all_josbs = self.sever.get_all_jobs()print(self.sever.jobs_count())for job in all_josbs: print(job['name'])# 获取构建日志 def get_build_console_output(self, job_name): number = self.get_build_number(job_name) resps = (self.sever.get_build_console_output(job_name, number))print(resps)# 生成ios下载的绝对URL def getIosAbsoluteURL(self, job_name): ios_download_url = base_ios_debug_download_url + str(self.get_build_number(job_name)) + '/' + self.getPkgName(job_name)return ios_download_url# 生成android下载的绝对URL def getAndroidAbsoluteURL(self, job_name): android_download_url = base_android_debug_download_url + str(self.get_build_number(job_name)) + '/' + self.getPkgName(job_name)return android_download_url# 拼接包名 def getPkgName(self, job_name): number = self.get_build_number(job_name)if job_name == 'carpool_iosbuild': pkg_name = 'iOS包名前缀' + str(number) + '_.ipa' # print(pkg_name) return pkg_nameelse: pkg_name = 'Android包名.apk' return pkg_name# 从Jenkins下载最新ios App def download_ios_app(self, job_name): local = os.path.join('/Users/didi/Downloads/', self.getPkgName(job_name)) ios_download_url = self.getIosAbsoluteURL(job_name)print('开始下载iOS App...') urllib.urlretrieve(ios_download_url, local)print('iOS App 下载完成')# 从Jenkins下载最新android App def download_android_app(self, job_name): local = os.path.join('/Users/didi/Downloads/', self.getPkgName(job_name)) android_download_url = self.getAndroidAbsoluteURL(job_name)print('开始下载Android App...') urllib.urlretrieve(android_download_url, local)print('Android App 下载完成')# 下载进度 def callbackfunc(blocknum, blocksize, totalsize): '''回调函数 @blocknum: 已经下载的数据块 @blocksize: 数据块的大小 @totalsize: 远程文件的大小 ''' percent = 100.0 * blocknum * blocksize / totalsize if percent > 100: percent = 100 print "%.2f%%" % percent# 重命名ios app def rename(self, file_dir, file_name): os.chdir(file_dir) #切换目录 # print "当前目录为: %s" % os.listdir(os.getcwd()) for root, dirs, files in os.walk(file_dir): os.listdir(os.getcwd()) # 获得当前目录中的内容 for file in files: if os.path.splitext(file)[1] == '.ipa': os.rename(file_name, 'xxx'+ios_app_suffix)print('ios app已重命名为 xxx.ipa')return #从Jenkins下载最新的构建包 def download_app_from_jenkins(self): jt = Jenkins_Tool() start_download_time = datetime.now() # 开始下载时间 jt.download_ios_app('ios-job') jt.rename('/Users/didi/Downloads/',jt.getPkgName('ios-job')) jt.download_android_app('android-job') end_download_time = datetime.now() # 下载完成时间 print('Android & iOS下载耗时:' + str((end_download_time - start_download_time).seconds))return True

优秀的个人博客,低调大师

【实战】一键制作10镜像

总结: ** 镜像逐个完成,最终整理成一个整体、统一的脚本。--不用cd 半天,在一个目录下,执行所有的命令,可以直接完成。** 目录说明: |-1Dockerfile-所有镜像制作的dockerfile |-2properties-所有镜像的配置文件,现阶段使用外挂的模式;还有mysql的数据,也采用外挂的模式 |-3logs-所有镜像的日志,挂外出来 |-4doc-这个镜像制作过程的日志以及说明 |-build.html-build脚本,cd到这个目录下,执行脚本 build 全脚本:[创建10个镜像] ##its-image-base:1.0 docker build --rm=true --no-cache=false -t its-image-base:1.0 1Dockerfile/00its-image-base/ ##its-mysql:1.0 docker pull mysql:5.6.38 ##its-xnet:1.0 docker build --rm=true --no-cache=false -t its-xnetd:1.0 1Dockerfile/02its-xnetd/ ##its-margin:1.0 docker build --rm=true --no-cache=false -t its-margin:1.0 1Dockerfile/03its-margin/ ##its-td:1.0 docker build --rm=true --no-cache=false -t its-td:1.0 1Dockerfile/04its-td/ ##its-forward:1.0 docker build --rm=true --no-cache=false -t its-forward:1.0 1Dockerfile/05its-forward/ ##its-cust:1.0 docker build --rm=true --no-cache=false -t its-cust:1.0 1Dockerfile/06its-cust/ ##its-price:1.0 docker build --rm=true --no-cache=false -t its-price:1.0 1Dockerfile/07its-price/ ##its-manage:1.0 docker build --rm=true --no-cache=false -t its-manage:1.0 1Dockerfile/08its-manage/ ##its-batch:1.0 docker build --rm=true --no-cache=false -t its-batch:1.0 1Dockerfile/09its-batch/ ##its-bigdata:1.0 docker build --rm=true --no-cache=false -t its-bigdata:1.0 1Dockerfile/10its-bigdata/ <font color="red" size="5"> 直接执行,所有镜像制作成功</font> build执行情况日志: localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-image-base:1.0 1Dockerfile/00its-image-base/ Sending build context to Docker daemon 189MB Step 1/16 : FROM centos:7.4.1708 ---> 3afd47092a0e Step 2/16 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 18f37c166e2e Step 3/16 : RUN mkdir /usr/soft ---> Using cache ---> f80d65eee5a5 Step 4/16 : RUN mkdir /usr/local/jdk ---> Using cache ---> e7be9f11d885 Step 5/16 : COPY jdk-8u60-linux-x64.tar.gz /usr/soft/jdk-8u60-linux-x64.tar.gz ---> 5e4874cc9379 Removing intermediate container d5fe2552cffc Step 6/16 : RUN tar xvf /usr/soft/jdk-8u60-linux-x64.tar.gz -C /usr/local/jdk ---> Running in e61e6f0fe669 jdk1.8.0_60/ ....省略 jdk1.8.0_60/release ---> db49ab363922 Removing intermediate container e61e6f0fe669 Step 7/16 : RUN rm -rf /usr/soft/jdk-8u60-linux-x64.tar.gz ---> Running in b1ec29837a19 ---> 09f53ba58fa3 Removing intermediate container b1ec29837a19 Step 8/16 : RUN mkdir -p /usr/local/work/tomcat ---> Running in b630fdd5301d ---> a36db1fe8b51 Removing intermediate container b630fdd5301d Step 9/16 : COPY apache-tomcat-7.0.34.tar.gz /usr/soft/apache-tomcat-7.0.34.tar.gz ---> fb23dfd5122b Removing intermediate container 0a733616d4d9 Step 10/16 : RUN tar xvf /usr/soft/apache-tomcat-7.0.34.tar.gz -C /usr/local/work/tomcat ---> Running in 5538505516fd apache-tomcat-7.0.34/bin/catalina.sh ....省略 apache-tomcat-7.0.34/webapps/manager/xform.xsl ---> 76f846827158 Removing intermediate container 5538505516fd Step 11/16 : RUN rm -rf /usr/soft/apache-tomcat-7.0.34.tar.gz ---> Running in bd541bffc47f ---> 7e63114de4ec Removing intermediate container bd541bffc47f Step 12/16 : ENV JAVA_HOME /usr/local/jdk/jdk1.8.0_60 ---> Running in acc62ff41fdc ---> d0b0b488f7d6 Removing intermediate container acc62ff41fdc Step 13/16 : ENV CATALINA_HOME /usr/local/work/tomcat/apache-tomcat-7.0.34 ---> Running in ca28fa816a92 ---> e74e966ab476 Removing intermediate container ca28fa816a92 Step 14/16 : ENV PATH $PATH:$JAVA_HOME/bin:$CATCHA_HOME/bin ---> Running in 5d9bbce26569 ---> 351822198b86 Removing intermediate container 5d9bbce26569 Step 15/16 : EXPOSE 8080 ---> Running in d88c1d77293e ---> e8ad0c1f271b Removing intermediate container d88c1d77293e Step 16/16 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 81f6b1bcc102 ---> 1362ffd827f7 Removing intermediate container 81f6b1bcc102 Successfully built 1362ffd827f7 Successfully tagged its-image-base:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-xnetd:1.0 1Dockerfile/02its-xnetd/ Sending build context to Docker daemon 1.182MB Step 1/10 : FROM centos:7.4.1708 ---> 3afd47092a0e Step 2/10 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 18f37c166e2e Step 3/10 : RUN mkdir /usr/xnetd_bin ---> Using cache ---> 50c37da1185f Step 4/10 : COPY xnetd_bin/xnetd /usr/xnetd_bin/xnetd ---> d72a35b8a725 Removing intermediate container 6bbf1a95a550 Step 5/10 : COPY xnetd_bin/start.sh /usr/xnetd_bin/start.sh ---> 1e5c2f696f9d Removing intermediate container 84416e39cfbe Step 6/10 : COPY xnetd_bin/.config /root/.config ---> e92557b38cc6 Removing intermediate container 48fb09082c33 Step 7/10 : RUN mkdir -p /root/logs/13300/xnetd ---> Running in ba91f717a5b4 ---> 76171c21d3e9 Removing intermediate container ba91f717a5b4 Step 8/10 : RUN mkdir -p /root/logs/17300/xnetd ---> Running in 51d1d489dbea ---> bdb2ee1bcb18 Removing intermediate container 51d1d489dbea Step 9/10 : EXPOSE 13300 17300 ---> Running in 873e4cebf5bf ---> 5f921045e8dd Removing intermediate container 873e4cebf5bf Step 10/10 : CMD sh /usr/xnetd_bin/start.sh && tail -f /root/.config ---> Running in a7baa475233d ---> 84a490a2c595 Removing intermediate container a7baa475233d Successfully built 84a490a2c595 Successfully tagged its-xnetd:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-margin:1.0 1Dockerfile/03its-margin/ Sending build context to Docker daemon 131.4MB Step 1/6 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/6 : MAINTAINER Will wangzhenwei@erayt.com ---> Running in 66ea96aa8968 ---> 15180ae8da59 Removing intermediate container 66ea96aa8968 Step 3/6 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginTrade ---> Running in b7beb6d1fdd5 ---> 5af619496e06 Removing intermediate container b7beb6d1fdd5 Step 4/6 : COPY marginTrade /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginTrade ---> 7192873ff0cd Removing intermediate container f6b958545357 Step 5/6 : EXPOSE 9990 ---> Running in 6e86e5b7fd09 ---> a9e454ae9be2 Removing intermediate container 6e86e5b7fd09 Step 6/6 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 88117f4e802a ---> 969a80689257 Removing intermediate container 88117f4e802a Successfully built 969a80689257 Successfully tagged its-margin:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-td:1.0 1Dockerfile/04its-td/ Sending build context to Docker daemon 81.15MB Step 1/5 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/5 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/5 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/sgeb ---> Running in c6bcdd4a7bad ---> 3ee59600bae1 Removing intermediate container c6bcdd4a7bad Step 4/5 : COPY sgeb /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/sgeb ---> c7e3b29daf58 Removing intermediate container b91bcd2148f4 Step 5/5 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 8171c20933f9 ---> 920ff7dfa45b Removing intermediate container 8171c20933f9 Successfully built 920ff7dfa45b Successfully tagged its-td:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-forward:1.0 1Dockerfile/05its-forward/ Sending build context to Docker daemon 164.2MB Step 1/6 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/6 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/6 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/forward ---> Running in e65d6125bea6 ---> c8357d8fb7bc Removing intermediate container e65d6125bea6 Step 4/6 : COPY forward /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/forward ---> 55054c03a74e Removing intermediate container c6f3560618d0 Step 5/6 : EXPOSE 8080 ---> Running in 8cb93c22f738 ---> 73a01e9c783d Removing intermediate container 8cb93c22f738 Step 6/6 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 19c9d62f85f1 ---> 94997aeeee5e Removing intermediate container 19c9d62f85f1 Successfully built 94997aeeee5e Successfully tagged its-forward:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-cust:1.0 1Dockerfile/06its-cust/ Sending build context to Docker daemon 403.2MB Step 1/8 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/8 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/cim ---> Running in 5cc6f622c706 ---> 7c158c3724ee Removing intermediate container 5cc6f622c706 Step 4/8 : COPY cim /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/cim ---> accb1058819c Removing intermediate container d74c067399a2 Step 5/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/xacc ---> Running in 68734b119af4 ---> 1af5148fc374 Removing intermediate container 68734b119af4 Step 6/8 : COPY xacc /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/xacc ---> fd0c050263c9 Removing intermediate container 82a7b5fcb5d9 Step 7/8 : EXPOSE 9992 9991 ---> Running in e7a3bfcb2ebf ---> a1d12331f930 Removing intermediate container e7a3bfcb2ebf Step 8/8 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 45f2b64ef8db ---> c735b8507c90 Removing intermediate container 45f2b64ef8db Successfully built c735b8507c90 Successfully tagged its-cust:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-price:1.0 1Dockerfile/07its-price/ Sending build context to Docker daemon 172.9MB Step 1/8 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/8 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/info ---> Running in 1ea982c39ccf ---> 9049a53d187b Removing intermediate container 1ea982c39ccf Step 4/8 : COPY info /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/info ---> d78c1aff8a8e Removing intermediate container 9b8bed7bf025 Step 5/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/quotation ---> Running in 96be890e55ef ---> d45603d20994 Removing intermediate container 96be890e55ef Step 6/8 : COPY quotation /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/quotation ---> 817c48a4091b Removing intermediate container f1e9cc5e44c6 Step 7/8 : EXPOSE 9990 ---> Running in 44ff6288583b ---> 2e74528209d8 Removing intermediate container 44ff6288583b Step 8/8 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 6eb7734914a9 ---> 9771a8b660bd Removing intermediate container 6eb7734914a9 Successfully built 9771a8b660bd Successfully tagged its-price:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-manage:1.0 1Dockerfile/08its-manage/ Sending build context to Docker daemon 324.7MB Step 1/10 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/10 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/callOrder ---> Running in 79eec2e2ab6d ---> 4b1872084ff1 Removing intermediate container 79eec2e2ab6d Step 4/10 : COPY callOrder /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/callOrder ---> 649a6143473b Removing intermediate container 61218f46a044 Step 5/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/ecas ---> Running in 2dbaf106895a ---> 974728901303 Removing intermediate container 2dbaf106895a Step 6/10 : COPY ecas /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/ecas ---> 49e7af424594 Removing intermediate container b0b1db9b84c4 Step 7/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/simManage ---> Running in 6cfab4758048 ---> e6200c1a4fbc Removing intermediate container 6cfab4758048 Step 8/10 : COPY simManage /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/simManage ---> e24eb4799474 Removing intermediate container 1cba973cafae Step 9/10 : EXPOSE 9993 9994 8080 ---> Running in ac805a94da61 ---> ae57411516bf Removing intermediate container ac805a94da61 Step 10/10 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in cdf295850084 ---> 751e3f88905c Removing intermediate container cdf295850084 Successfully built 751e3f88905c Successfully tagged its-manage:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-batch:1.0 1Dockerfile/09its-batch/ Sending build context to Docker daemon 304.3MB Step 1/7 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/7 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/7 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/eops ---> Running in 88a25f6b1c95 ---> bf528afd9e34 Removing intermediate container 88a25f6b1c95 Step 4/7 : COPY eops /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/eops ---> 823065e2081d Removing intermediate container 336c468298be Step 5/7 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginBatch ---> Running in 3b1a3e1d3062 ---> ee8aff5f37e2 Removing intermediate container 3b1a3e1d3062 Step 6/7 : COPY marginBatch /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginBatch ---> 860c40504adf Removing intermediate container 21dc27f5ac26 Step 7/7 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 18b1b0e5dcaa ---> 02439a601ceb Removing intermediate container 18b1b0e5dcaa Successfully built 02439a601ceb Successfully tagged its-batch:1.0 localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-bigdata:1.0 1Dockerfile/10its-bigdata/ Sending build context to Docker daemon 58.01MB Step 1/5 : FROM its-image-base:1.0 ---> 1362ffd827f7 Step 2/5 : MAINTAINER Will wangzhenwei@erayt.com ---> Using cache ---> 15180ae8da59 Step 3/5 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/GEnquiry ---> Running in 6d7737a02cac ---> c2e231b1c4e2 Removing intermediate container 6d7737a02cac Step 4/5 : COPY GEnquiry /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/GEnquiry ---> ca1a5038a4d4 Removing intermediate container 824f5238cb77 Step 5/5 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run ---> Running in 6857f922ef25 ---> 060e9de6513a Removing intermediate container 6857f922ef25 Successfully built 060e9de6513a Successfully tagged its-bigdata:1.0 localhost:sim_docker wangzhenwei$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE its-bigdata 1.0 060e9de6513a 16 minutes ago 820MB its-batch 1.0 02439a601ceb 16 minutes ago 1.07GB its-manage 1.0 751e3f88905c 17 minutes ago 1.09GB its-price 1.0 9771a8b660bd 17 minutes ago 935MB its-cust 1.0 c735b8507c90 17 minutes ago 1.16GB its-forward 1.0 94997aeeee5e 18 minutes ago 926MB its-td 1.0 920ff7dfa45b 18 minutes ago 842MB its-margin 1.0 969a80689257 18 minutes ago 893MB its-xnetd 1.0 84a490a2c595 19 minutes ago 198MB its-image-base 1.0 1362ffd827f7 21 minutes ago 762MB

优秀的个人博客,低调大师

一键修改配置文件

import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.util.Arrays; import java.util.Properties; /** * @author: rongyu * @Date: 2018-07-23 14:04:29 */ public class Main { /** * 配置文件,你需要修改的键值对写入进去 */ private static String domainProperties = "A.properties"; /** * 添加文件的备注 */ private static String comments = "rongyu"; private static String projectPath = "E:\\code\\yousesky_hry_code"; public static void main(String[] args) throws IOException { traverseFolder(projectPath); } public static String getMyProperties(String myProperties) { return Main.class.getResource("/").getPath() + myProperties; } public static Properties getProperties(String propertiesPath) throws IOException { FileReader fileReader = new FileReader(propertiesPath); Properties properties = new Properties(); properties.load(fileReader); fileReader.close(); return properties; } public static Properties transformation(Properties from, Properties to) { to.stringPropertyNames().forEach( x -> { String value = from.getProperty(x); if (value != null && !"".equals(value)) to.setProperty(x, value); } ); return to; } public static void update(String path, String comments) throws IOException { String myPropertiesPath = getMyProperties(domainProperties); Properties myProperties = getProperties(myPropertiesPath); Properties targetProperties = getProperties(path); Properties transProperties = transformation(myProperties, targetProperties); transProperties.store(new FileOutputStream(path), comments); } public static void traverseFolder(String path) { File file = new File(path); if (file.exists()) { File[] files = file.listFiles(); if (null == files || files.length == 0) { return; } else { Arrays.stream(files).forEach( x -> { if (x.isDirectory()) traverseFolder(x.getAbsolutePath()); else { String name = x.getName(); if (name.contains(".")) { String substring = name.substring(name.lastIndexOf(".", name.length())); if (substring.equals(".properties")) { // TODO 替换文件 System.out.println(x.getAbsolutePath()); try { update(x.getAbsolutePath(), comments); } catch (IOException e) { System.out.println(x.getAbsolutePath() + "修改失败"); e.printStackTrace(); } } } } } ); } } else { System.out.println("文件不存在!"); } } }

优秀的个人博客,低调大师

docker一键部署hadoop心得(二)

今天在运行MapReduce程序时,虽然wordcount实例运行成功了,但后面出现了重新使用历史服务器失败的错误 17/12/22 13:33:19 INFO ipc.Client: Retrying connect to server: hadoop-slave1/172.18.0.11:45463. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)17/12/22 13:33:20 INFO ipc.Client: Retrying connect to server: hadoop-slave1/172.18.0.11:45463. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)17/12/22 13:33:21 INFO ipc.Client: Retrying connect to server: hadoop-slave1/172.18.0.11:45463. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=3, sleepTime=1000 MILLISECONDS)17/12/22 13:33:28 INFO mapred.ClientServiceDelegate: Application state is completed. FinalApplicationStatus=SUCCEEDED. Redirecting to job history server17/12/22 13:33:30 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:31 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:32 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:33 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:34 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:35 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:36 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:37 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:38 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:39 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:40 INFO mapred.ClientServiceDelegate: Application state is completed. FinalApplicationStatus=SUCCEEDED. Redirecting to job history server17/12/22 13:33:41 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:42 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:43 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:44 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:45 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:46 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:47 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:48 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:49 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:50 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:50 INFO mapred.ClientServiceDelegate: Application state is completed. FinalApplicationStatus=SUCCEEDED. Redirecting to job history server17/12/22 13:33:51 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:52 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:53 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:54 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:55 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:56 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:57 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:58 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:33:59 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)17/12/22 13:34:00 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:10020. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)java.io.IOException: java.net.ConnectException: Call From hadoop-master/172.18.0.10 to 0.0.0.0:10020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused at org.apache.hadoop.mapred.ClientServiceDelegate.invoke(ClientServiceDelegate.java:344) at org.apache.hadoop.mapred.ClientServiceDelegate.getJobStatus(ClientServiceDelegate.java:429) at org.apache.hadoop.mapred.YARNRunner.getJobStatus(YARNRunner.java:601) at org.apache.hadoop.mapreduce.Job$1.run(Job.java:323) at org.apache.hadoop.mapreduce.Job$1.run(Job.java:320) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1746) at org.apache.hadoop.mapreduce.Job.updateStatus(Job.java:320) at org.apache.hadoop.mapreduce.Job.isSuccessful(Job.java:616) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1323) at org.apache.hadoop.examples.WordCount.main(WordCount.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:71) at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144) at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)Caused by: java.net.ConnectException: Call From hadoop-master/172.18.0.10 to 0.0.0.0:10020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:792) at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:732) at org.apache.hadoop.ipc.Client.call(Client.java:1480) at org.apache.hadoop.ipc.Client.call(Client.java:1413) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229) at com.sun.proxy.$Proxy15.getJobReport(Unknown Source) at org.apache.hadoop.mapreduce.v2.api.impl.pb.client.MRClientProtocolPBClientImpl.getJobReport(MRClientProtocolPBClientImpl.java:133) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.mapred.ClientServiceDelegate.invoke(ClientServiceDelegate.java:325) ... 24 moreCaused by: java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495) at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:615) at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:713) at org.apache.hadoop.ipc.Client$Connection.access$2900(Client.java:376) at org.apache.hadoop.ipc.Client.getConnection(Client.java:1529) at org.apache.hadoop.ipc.Client.call(Client.java:1452) ... 32 more​

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册