最近在重裝ambari的適合,遇到yum清理的時候,無法清理,從報錯看,是由於一個yum資源文件無法解析造成,然后順着日志找
[root@xcyhdp03 ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: HDP-2.6-repo-1 HDP-2.6.4.0 HDP-GPL-2.6.4.0 HDP-UTILS-1.1.0.22 HDP-UTILS-1.1.0.22-repo-1 ambari-2.6.1.5 base extras updates Cleaning up list of fastest mirrors [root@xcyhdp03 ~] [root@xcyhdp03 ~] [root@xcyhdp03 ~]# yum makecache Loaded plugins: fastestmirror Determining fastest mirrors http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.4.0/repodata/repomd.xml: [Errno 14] HTTP Error 403 - Forbidden Trying other mirror. To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. One of the configured repositories failed (HDP-2.6-GPL-repo-1), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 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=HDP-2.6-GPL-repo-1 ... 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 HDP-2.6-GPL-repo-1 or subscription-manager repos --disable=HDP-2.6-GPL-repo-1 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=HDP-2.6-GPL-repo-1.skip_if_unavailable=true
發現/etc/yum.repos.d/HDP-2.6-GPL-repo-1.yum中,有一個源是HDP-2.6-GPL-repo-1,它的baseurl,用的是國外的網站http://public-repo-1.hortonworks.com,無法訪問,造成無法使用yum源
[HDP-2.6-repo-1] name=HDP-2.6-repo-1 baseurl=http://192.168.56.40/yum/HDP/centos7/2.6.4.0-91/ path=/ enabled=1 gpgcheck=0 [HDP-2.6-GPL-repo-1] name=HDP-2.6-GPL-repo-1 baseurl=http://public-repo-1.hortonworks.com/HDP-GPL/centos7/2.x/updates/2.6.4.0 path=/ enabled=1 gpgcheck=0 [HDP-UTILS-1.1.0.22-repo-1] name=HDP-UTILS-1.1.0.22-repo-1 baseurl=http://192.168.56.40/yum/HDP-UTILS/centos7/1.1.0.22/ path=/ enabled=1 gpgcheck=0
自然習慣性的就刪除掉中間那段yum配置,但是重新安裝的時候,發現這段被注釋的yum源又重新恢復了,看來這段yum配置,應該是保存在ambari的數據庫,或者是ambari-server節點的yum源上,經過查找,終於在ambari源數據庫的repo_version表,找到yum源的配置
repositories字段中和version_xml都有三個repo配置,其原理是,如果yum源中已經配置,則不修改,如果沒配置,就會添加進去
手動修改將其中不需要的地方刪除,再次更新回數據庫中

刪掉紅色中的內容,再保存回數據庫


測試更新yum源,ok
[root@xcyhdp01 yum.repos.d]# yum clean all Loaded plugins: fastestmirror Cleaning repos: HDP-2.6-repo-1 HDP-2.6.4.0 HDP-GPL-2.6.4.0 HDP-UTILS-1.1.0.22 HDP-UTILS-1.1.0.22-repo-1 ambari-2.6.1.5 base extras updates Cleaning up list of fastest mirrors [root@xcyhdp01 yum.repos.d]# yum makecache Loaded plugins: fastestmirror Determining fastest mirrors HDP-2.6-repo-1 | 2.9 kB 00:00:00 HDP-2.6.4.0 | 2.9 kB 00:00:00 HDP-GPL-2.6.4.0 | 2.9 kB 00:00:00 HDP-UTILS-1.1.0.22 | 2.9 kB 00:00:00 HDP-UTILS-1.1.0.22-repo-1 | 2.9 kB 00:00:00 ambari-2.6.1.5 | 2.9 kB 00:00:00 base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/28): HDP-2.6-repo-1/filelists_db | 421 kB 00:00:00 (2/28): HDP-2.6-repo-1/other_db | 14 kB 00:00:00 (3/28): HDP-2.6.4.0/filelists_db | 421 kB 00:00:00 (4/28): HDP-2.6.4.0/primary_db | 99 kB 00:00:00 (5/28): HDP-2.6.4.0/other_db | 14 kB 00:00:00 (6/28): HDP-2.6-repo-1/primary_db | 99 kB 00:00:00 (7/28): HDP-GPL-2.6.4.0/filelists_db | 1.2 kB 00:00:00 (8/28): HDP-GPL-2.6.4.0/primary_db | 2.9 kB 00:00:00 (9/28): HDP-GPL-2.6.4.0/other_db | 867 B 00:00:00 (10/28): HDP-UTILS-1.1.0.22/primary_db | 8.5 kB 00:00:00 (11/28): HDP-UTILS-1.1.0.22/filelists_db | 2.9 kB 00:00:00 (12/28): HDP-UTILS-1.1.0.22/other_db | 5.5 kB 00:00:00 (13/28): HDP-UTILS-1.1.0.22-repo-1/filelists_db | 2.9 kB 00:00:00 (14/28): HDP-UTILS-1.1.0.22-repo-1/primary_db | 8.5 kB 00:00:00 (15/28): HDP-UTILS-1.1.0.22-repo-1/other_db | 5.5 kB 00:00:00 (16/28): ambari-2.6.1.5/filelists_db | 168 kB 00:00:00 (17/28): ambari-2.6.1.5/primary_db | 8.6 kB 00:00:00 (18/28): ambari-2.6.1.5/other_db | 1.3 kB 00:00:00 (19/28): base/7/x86_64/group_gz | 153 kB 00:00:00 (20/28): base/7/x86_64/filelists_db | 7.2 MB 00:00:19 (21/28): extras/7/x86_64/primary_db | 242 kB 00:00:07 (22/28): extras/7/x86_64/other_db | 143 kB 00:00:00 (23/28): extras/7/x86_64/filelists_db | 235 kB 00:00:07 (24/28): updates/7/x86_64/primary_db | 8.8 MB 00:00:01 (25/28): updates/7/x86_64/other_db | 681 kB 00:00:01 (26/28): updates/7/x86_64/filelists_db | 5.1 MB 00:00:07 base/7/x86_64/primary_db FAILED 86% [=================================================================================================================== ] 321 kB/s | 28 MB 00:00:13 ETA https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds') Trying other mirror. base/7/x86_64/other_db FAILED 80% [==========================================================================================================- ] 28 B/s | 26 MB 66:45:31 ETA https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds') Trying other mirror. (27/28): base/7/x86_64/primary_db | 6.1 MB 00:00:00 (28/28): base/7/x86_64/other_db | 2.6 MB 00:00:00 Metadata Cache Created