Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open (Local DynamoDB) database file after power outage

History: I was able to get read/write to my local DynamoDB environment. I followed the AWS Documents for Downloading and Running DynamoDB [http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html]

Issue: I had an accidental power outage to my computer. Now, I get the following error after I launch the DynamoDB process

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

Error Message:

Aug 23, 2017 3:52:42 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] SQLiteQueue[shared-local-instance.db]: stopped abnormally, reincarnating in 3000ms
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] cannot open DB[2]: com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
SEVERE: [sqlite] SQLiteQueue[shared-local-instance.db]: error running job queue
com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1480)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)

Attempts: This post is the closest to my error but it involves not DynamoDB but some Cloud logs, etc. [https://forums.aws.amazon.com/thread.jspa?threadID=165134]

Any thoughts on how to rectify the database file?

like image 570
Jordan Lee Avatar asked Aug 23 '17 23:08

Jordan Lee


People also ask

How to run DynamoDB offline on another port?

You can run DynamoDB Offline on a different port by specifying -p option to the sls offline start command like so:

Why can't I start DynamoDB?

The problem (in my case) was that another application was using the port 8000 which dynamodb uses. Therefore, there was a conflict and the process couldn't start. This will give you further information.

How do I deploy my application to production with DynamoDB?

When you're ready to deploy your application in production, you remove the local endpoint in the code, and then it points to the DynamoDB web service. Having this local version helps you save on throughput, data storage, and data transfer fees.

What port does DynamoDB local use in Java?

Java-based distribution of DynamoDB Local uses port 8000 by default. If it's not available, DynamoDB Local shouldn't even start. If it was started with custom port (like in Amplify's case ), you can run following command: And find a number supplied as -port. For example, in following result:


4 Answers

It could be a permission issue. try updating permissions.

sudo chown user dynamodb -R
chmod 775 -R dynamodb
like image 99
Zudhin Avatar answered Oct 16 '22 11:10

Zudhin


It is indeed a permission issue as suggested by Zudhin https://stackoverflow.com/a/53132375/239613

In my case, I'm running Ubuntu and the quick and dirty solution I found is just changing the permissions of the local folder for the volume:

sudo chmod 777 ./docker/dynamodb (provided that's your local folder after following https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html)

like image 26
gfournier Avatar answered Oct 16 '22 12:10

gfournier


I had faced a similar error with Docker on Windows and the solution was to give 'System' all the permissions for the Docker Volume which persisted the DB Data

like image 40
Rohan Sawant Avatar answered Oct 16 '22 11:10

Rohan Sawant


Quick solution was to reinstall everything.

rm -rf <unzipped DynamoDB Local folder>

Then, go back through the installation instructions. http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

I'm unfamiliar with jar files. Replacing them with new jar files is like reinstalling?

like image 1
Jordan Lee Avatar answered Oct 16 '22 11:10

Jordan Lee