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試試。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM