安装Mariadb10.0时yum镜像报错 HTTP Error 404 – Not Found

概述

在安装CDH时,选择了Mariadb数据库作为Cloudera-Mananger的数据库,一开始时,由于没有仔细研究安装文档,安装了Mariadb10.4,发现cm-server启动时报错:

2020-04-22 18:57:51,209 FATAL main:org.hsqldb.cmdline.SqlFile: SQL Error at 'UTF-8' line 2:
"alter table SERVICES
    drop foreign key FK_SERVICE_CONFIG_REVISION"
Can't DROP FOREIGN KEY `FK_SERVICE_CONFIG_REVISION`; check that it exists
2020-04-22 18:57:51,209 ERROR main:com.cloudera.enterprise.dbutil.SqlFileRunner: Exception while executing ddl scripts.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can't DROP FOREIGN KEY `FK_SERVICE_CONFIG_REVISION`; check that it exists
        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:422)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
        at com.mysql.jdbc.Util.getInstance(Util.java:387)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
        at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:839)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:739)
        at org.hsqldb.cmdline.SqlFile.processSQL(Unknown Source)
        at org.hsqldb.cmdline.SqlFile.scanpass(Unknown Source)
        at org.hsqldb.cmdline.SqlFile.execute(Unknown Source)
        at com.cloudera.enterprise.dbutil.SqlFileRunner.runSqlFile(SqlFileRunner.java:68)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlStringRunner.run(SqlScriptRunnerFactory.java:211)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlScriptRunnerComposite.run(SqlScriptRunnerFactory.java:139)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlScriptRunnerComposite.run(SqlScriptRunnerFactory.java:139)
        at com.cloudera.enterprise.dbutil.DbUtil.runScripts(DbUtil.java:444)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchemaInternal(DbUtil.java:384)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchema(DbUtil.java:354)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchema(DbUtil.java:330)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.checkSchemaDoUpgrade(EntityManagerFactoryBean.java:350)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:128)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:65)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1440)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:247)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at com.cloudera.server.cmf.Main.bootstrapSpringContext(Main.java:393)
        at com.cloudera.server.cmf.Main.<init>(Main.java:243)
        at com.cloudera.server.cmf.Main.main(Main.java:216)
2020-04-22 18:57:51,213 ERROR main:com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean: Unable to upgrade schema to latest version.
java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can't DROP FOREIGN KEY `FK_SERVICE_CONFIG_REVISION`; check that it exists
        at com.cloudera.enterprise.dbutil.SqlFileRunner.runSqlFile(SqlFileRunner.java:86)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlStringRunner.run(SqlScriptRunnerFactory.java:211)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlScriptRunnerComposite.run(SqlScriptRunnerFactory.java:139)
        at com.cloudera.enterprise.dbutil.SqlScriptRunnerFactorySqlScriptRunnerComposite.run(SqlScriptRunnerFactory.java:139)
        at com.cloudera.enterprise.dbutil.DbUtil.runScripts(DbUtil.java:444)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchemaInternal(DbUtil.java:384)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchema(DbUtil.java:354)
        at com.cloudera.enterprise.dbutil.DbUtil.upgradeSchema(DbUtil.java:330)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.checkSchemaDoUpgrade(EntityManagerFactoryBean.java:350)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:128)
        at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:65)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1440)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:247)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at com.cloudera.server.cmf.Main.bootstrapSpringContext(Main.java:393)
        at com.cloudera.server.cmf.Main.<init>(Main.java:243)
        at com.cloudera.server.cmf.Main.main(Main.java:216)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Can't DROP FOREIGN KEY `FK_SERVICE_CONFIG_REVISION`; check that it exists
        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:422)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
        at com.mysql.jdbc.Util.getInstance(Util.java:387)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
        at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:839)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:739)
        at org.hsqldb.cmdline.SqlFile.processSQL(Unknown Source)
        at org.hsqldb.cmdline.SqlFile.scanpass(Unknown Source)
        at org.hsqldb.cmdline.SqlFile.execute(Unknown Source)
        at com.cloudera.enterprise.dbutil.SqlFileRunner.runSqlFile(SqlFileRunner.java:68)
        ... 33 more

经过几次排查,找到相关文档,原因是Mariadb的版本太高。现在要做的要么降低Mariadb的版本,要么安装mysql。为了坚持将错误进行到底的作风,因此不放弃使用Mariadb,继续选择它。

按照网上的教程,配置/etc/yum.repo.d/mariadb.repo:

# MariaDB 10.0 CentOS repository list - created 2016-05-30 02:16 UTC# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
#baseurl = http://yum.mariadb.org/10.0/centos7-amd64
baseurl = http://archive.mariadb.org/mariadb-10.0.10/yum/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck= 0

然后查配置yum源对应的mariadb版本是否正确:

yum makecache

然而报错了:

$ yum makecache
Loaded plugins: fastestmirror
base                                                                                  | 3.6 kB  00:00:00     
extras                                                                                | 2.9 kB  00:00:00     
mariadb                                                                               | 2.9 kB  00:00:00     
Not using downloaded mariadb/repomd.xml because it is older than what we have:
  Current   : Tue Jan 28 05:56:24 2020
  Downloaded: Sun Feb  3 11:08:07 2019
updates                                                                               | 2.9 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
mariadb/other_db               FAILED                                          
http://yum.mariadb.org/10.0/centos7-amd64/repodata/d99e4a2af1a49ac36830888f5980abc0b74bf37bcf557d1aa00bdd049610d55b-other.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

mariadb/filelists_db           FAILED                                          
http://yum.mariadb.org/10.0/centos7-amd64/repodata/45711fd0b9b18abc6013fe2e3b978c69aeb8d8bd2f83ea85786bd29355eb3a46-filelists.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://yum.mariadb.org/10.0/centos7-amd64/repodata/45711fd0b9b18abc6013fe2e3b978c69aeb8d8bd2f83ea85786bd29355eb3a46-filelists.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (MariaDB),
 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=mariadb ...

     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 mariadb
        or
            subscription-manager repos --disable=mariadb

     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=mariadb.skip_if_unavailable=true

failure: repodata/45711fd0b9b18abc6013fe2e3b978c69aeb8d8bd2f83ea85786bd29355eb3a46-filelists.sqlite.bz2 from mariadb: [Errno 256] No more mirrors to try.
http://yum.mariadb.org/10.0/centos7-amd64/repodata/45711fd0b9b18abc6013fe2e3b978c69aeb8d8bd2f83ea85786bd29355eb3a46-filelists.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found

问题原因显而易见,yum源坏了。那就动手修复吧!

yum clean all
rpm --rebuilddb
yum update

一通操作猛如虎,效果就只能慢慢等了……在20分钟后,终于更新完成了。再次执行yum makecache,发现已无问题。

点击数:44

发表评论