zoukankan      html  css  js  c++  java
  • Cannot find a valid baseurl for repo: HDP-3.1-repo-1或者ambari错误Connection to vm-16-6-centos closed.解决方法

    在ambari安装大数据集群的时候,报如下错误:

    
         1. Contact the upstream for the repository and get them to fix the problem.
    
         2. Reconfigure the baseurl/etc. for the repository, to point to a working
            upstream. This is most often useful if you are using a newer
            distribution release than is supported by the repository (and the
            packages for the previous distribution release still work).
    
         3. Run the command with the repository temporarily disabled
                yum --disablerepo=<repoid> ...
    
         4. Disable the repository permanently, so yum won't use it by default. Yum
            will then just ignore the repository until you permanently enable it
            again or use --enablerepo for temporary usage:
    
                yum-config-manager --disable <repoid>
            or
                subscription-manager repos --disable=<repoid>
    
         5. Configure the failing repository to be skipped, if it is unavailable.
            Note that yum will try to contact the repo. when it runs most commands,
            so will have to try and fail each time (and thus. yum will be be much
            slower). If it is a very temporary problem though, this is often a nice
            compromise:
    
                yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
    
    Cannot find a valid baseurl for repo: HDP-3.1-repo-1
    Desired version (2.7.3.0) of ambari-agent package is not available.
    
    Connection to vm-16-6-centos closed.
    SSH command execution finished
    host=vm-16-6-centos, exitcode=1
    Command end time 2021-02-05 22:15:23
    
    ERROR: Bootstrap of host vm-16-6-centos fails because previous action finished with non-zero exit code (1)
    ERROR MESSAGE: Connection to vm-16-6-centos closed.
    

    发现/etc/yum.repos.d文件夹下“ambari-hdp-1.repo”内生成的"baseURL"为空。

    • 解决方法:
      a)删除掉/etc/yum.repos.d的“ambari-hdp-1.repo”文件
      根据错误“Cannot find a valid baseurl for repo: HDP-3.1-repo-1”,在所有集群机器上修改,打开/etc/yum.repos.d
    vim /etc/yum.repos.d
    #查看文件夹下是不是多了一个文件“ambari-hdp-1.repo”,直接在所有集群机器上删除掉就可以了
    rm -rf ambari-hdp-1.repo
    
      b)使用`grep 'baseurl' /etc/yum.repos.d/* | grep -i HDP`查看baseurl是不是为空
      c)`yum install hdp-select -y`查看报什么错误
      d)修改ambari`app.js`文件:
    

    cd /usr/lib/ambari-server/web/javascripts
    先备份cp app.js app.js_backup

    跳转到app.js约39892行,把
    
    /**
       * Use Local Repo if some network issues exist
       */
      onNetworkIssuesExist: function () {
        if (this.get('networkIssuesExist')) {
          this.get('content.stacks').forEach(function (stack) {
              stack.setProperties({
                usePublicRepo: false,
                useLocalRepo: true
              });
              stack.cleanReposBaseUrls();
          });
        }
      }.observes('networkIssuesExist'),
    改成:
    /**
       * Use Local Repo if some network issues exist
       */
      onNetworkIssuesExist: function () {
        if (this.get('networkIssuesExist')) {
          this.get('content.stacks').forEach(function (stack) {
            if(stack.get('useLocalRepo') != true){
              stack.setProperties({
                usePublicRepo: false,
                useLocalRepo: true
              });
              stack.cleanReposBaseUrls();
            } 
          });
        }
      }.observes('networkIssuesExist'),
    
     e)停止`ambari-server`  `ambari-server stop`
     f)登陆mysql:
    
    mysql -u root -p
    use ambari;
    select * from repo_definition;
    update repo_definition set base_url='<你的baseURL地址>' where id=<THE CORESPONDING ID>;
    
      g)重启启动`ambari-server`  `ambari-server start`
    

    如果生成的repo文件baseURL还是为空,则多ambari-server restart试试。

    -----------------------------------------------------------
    shotting source code
  • 相关阅读:
    java中动态给sql追加?号
    在java中构建json对象,返回给前端页面
    java中的文件下载
    Session和Cookie
    处理全站请求编码,无论是GET还是POST,默认是UTF-8
    配置Spring的用于初始化容器对象的监听器
    在web.xml中配置struts2拦截器
    java生成一次性验证码
    tab------左右布局
    java使用Base64编码
  • 原文地址:https://www.cnblogs.com/zh672903/p/14380026.html
Copyright © 2011-2022 走看看