Sqoop同步数据时候报错:
21/08/13 02:02:58 ERROR bonecp.PoolWatchThread: Error in trying to obtain a connection. Retrying in 7000ms
java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setReadOnly(Unknown Source)
at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1324)
at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:262)
at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:115)
at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: ERROR 25505: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericAuthorizer.setReadOnlyConnection(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.setReadOnly(Unknown Source)
... 8 more
在网上查资料都说是 db.lck
的权限问题:
在sqoop脚本的同级目录下,有个derby.log
:
$ cat derby.log
----------------------------------------------------------------
Fri Aug 13 00:00:07 CST 2021:
Booting Derby (version The Apache Software Foundation - Apache Derby - 10.14.1.0 - (1808820)) instance a816c00e-017b-3b17-9a29-000004c22c00
on database directory /var/lib/hive/metastore/metastore_db in READ ONLY mode with class loader sun.misc.Launcher$AppClassLoader@6fdb1f78.
Loaded from file:/opt/cloudera/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554/jars/derby-10.14.1.0.jar.
java.vendor=Oracle Corporation
java.runtime.version=1.8.0_212-b10
user.dir=/data/app/stars/script/ivs_co
os.name=Linux
os.arch=amd64
os.version=3.10.0-1127.19.1.el7.x86_64
derby.system.home=null
Database Class Loader started - derby.database.classpath=''
解决办法
按照如上提示解决即可