SparkSQL启动报错:A read-only user or a user in a read-only database is not permitted to disable ...

时间:2022-09-11 17:05:08
2018-05-18 14:58:07 WARN  NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2018-05-18 14:58:07 INFO  HiveMetaStore:589 - 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
2018-05-18 14:58:07 INFO  ObjectStore:289 - ObjectStore, initialize called
2018-05-18 14:58:07 INFO  Persistence:77 - Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
2018-05-18 14:58:07 INFO  Persistence:77 - Property datanucleus.cache.level2 unknown - will be ignored
2018-05-18 14:58:08 ERROR PoolWatchThread:118 - 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.

今天启动sparksql的时候遇到了之前没见过的错误,搜索一番之后也没有特别match的答案,特此记录一下。

其实是由于使用了root用户误启动sparksql,生成了一个属于root用户的文件db.lck,在SPARK_HOME/bin/metastore_db路径下,我们更改一下权限到我们使用的用户就好: 

chown -R hadoop:hadoop metastore_db