Error open RocksDB database when 'Set up a standalone Pulsar in Docker'
See original GitHub issueHello,
I am following the instruction on Set up a standalone Pulsar in Docker to setup Pular on windows 10 with the following command on both cmd.exe and powershell:
docker run -it -p 6650:6650 -p 8080:8080 -v "c:\docker\pulsar:/pulsar/data" apachepulsar/pulsar:2.4.1 bin/pulsar standalone
I am getting this error as appeared to be fixed already - per https://github.com/apache/pulsar/issues/3031:
01:24:26.913 [main] INFO org.apache.bookkeeper.discover.ZKRegistrationManager - INSTANCEID not exists in zookeeper. Not considering it for data verification
01:24:26.998 [main] INFO org.apache.bookkeeper.bookie.Bookie - instantiate ledger manager org.apache.bookkeeper.meta.HierarchicalLedgerManagerFactory
01:24:27.019 [main] ERROR org.apache.bookkeeper.bookie.Journal - Problems reading from data/standalone/bookkeeper0/current/lastMark (this is okay if it is the first time starting this bookie
01:24:27.021 [main] INFO org.apache.bookkeeper.bookie.Bookie - Using ledger storage: org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage
01:24:27.024 [main] INFO org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - Started Db Ledger Storage
01:24:27.025 [main] INFO org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - - Number of directories: 1
01:24:27.025 [main] INFO org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - - Write cache size: 1024 MB
01:24:27.025 [main] INFO org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - - Read Cache: 1024 MB
01:24:27.028 [main] INFO org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage - Creating single directory db ledger storage on data/standalone/bookkeeper0/current
01:24:27.139 [main] INFO org.apache.bookkeeper.proto.BookieNettyServer - Shutting down BookieNettyServer
01:24:27.172 [main] ERROR org.apache.pulsar.PulsarStandaloneStarter - Failed to start pulsar service.
java.io.IOException: Error open RocksDB database
at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.<init>(KeyValueStorageRocksDB.java:182) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.<init>(KeyValueStorageRocksDB.java:83) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.lambda$static$0(KeyValueStorageRocksDB.java:58) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.LedgerMetadataIndex.<init>(LedgerMetadataIndex.java:69) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.SingleDirectoryDbLedgerStorage.<init>(SingleDirectoryDbLedgerStorage.java:160) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage.newSingleDirectoryDbLedgerStorage(DbLedgerStorage.java:148) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.storage.ldb.DbLedgerStorage.initialize(DbLedgerStorage.java:128) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:790) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.proto.BookieServer.newBookie(BookieServer.java:137) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:106) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.runBookies(LocalBookkeeperEnsemble.java:272) ~[org.apache.pulsar-pulsar-zookeeper-utils-2.4.1.jar:2.4.1]
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.startStandalone(LocalBookkeeperEnsemble.java:396) ~[org.apache.pulsar-pulsar-zookeeper-utils-2.4.1.jar:2.4.1]
at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:259) ~[org.apache.pulsar-pulsar-broker-2.4.1.jar:2.4.1]
at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [org.apache.pulsar-pulsar-broker-2.4.1.jar:2.4.1]
Caused by: org.rocksdb.RocksDBException: While fsync: a directory: Invalid argument
at org.rocksdb.RocksDB.open(Native Method) ~[org.rocksdb-rocksdbjni-5.13.3.jar:?]
at org.rocksdb.RocksDB.open(RocksDB.java:231) ~[org.rocksdb-rocksdbjni-5.13.3.jar:?]
at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.<init>(KeyValueStorageRocksDB.java:179) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
... 13 more
01:24:27.182 [Thread-1] ERROR org.apache.pulsar.PulsarStandaloneStarter - Shutdown failed: null
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[GitHub] [pulsar] junlia opened a new issue #5392: Error open ...
junlia opened a new issue #5392: Error open RocksDB database when 'Set up a standalone Pulsar in Docker' URL: https://github.com/apache/pulsar/issues/5392 ...
Read more >Set up a standalone Pulsar locally
The standalone mode includes a Pulsar broker, the necessary RocksDB and BookKeeper components running inside of a single Java Virtual Machine (JVM) process....
Read more >org.apache.pulsar.commits - 2018 December - 1,335 messages ...
[pulsar] branch master updated: Change un-ack messages start tracking behavior ... request #3198: Error open RocksDB database in docker for windows - GitBox....
Read more >Understanding How Apache Pulsar Works - Jack Vanlightly
First up though I will be running some chaos tests on a Pulsar cluster ... If no data retention policy is set on...
Read more >Exchange FAQ - NebulaGraph Database Manual
Q: When Exchange imports Hive data, error: Exception in thread ... For docker installation, configure the docker mapped port number as ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is a Docker configuration issue. The command in the documentation:
Is faulty. Here’s why.
When the pulsar Docker image is built, it defines two volumes:
This means at run time the Docker image expects an externally mounted volume for those the two paths. When you do “docker run” without specifying any storage it will automatically create anonymous Docker volumes. It will look something like this:
The problem is the -v option in the command. This tries to create a bind mount at the same path in the container as one of the pre-specified volume mount points (/pulsar/data). This creates two mounts on the same path. Docker doesn’t barf on this (for some reason), but it obviously makes the file system behave strangely, causing RocksDB to barf.
PR #3918 mentions adding the ToLower() function to -v option to “fix” the issue. This doesn’t fix the issue at all. It avoids the error because it ends mangling the -v option so that it mounts a volume at /pulsar/data.ToLower(). This doesn’t collide with the pre-defined path so RocksDB works, but it doesn’t work at all as intended, since Pulsar is configured to expect its data to be in the /pulsar/data directory so /pulsar/data.ToLower() is never used.
The fix for this is simple, instead of messing around with bind mounts, give it a volume mount like it expects. And since we presumably want the data to persist between “docker run” commands, we just have to give the volume a name.
Here is what docker inspect gives:
The other advantage of using a named Docker volume is that we don’t have to mess around with path specifications, so no need for the $PWD variable, which is defined in PowerShell but not CommandPrompt (CMD). I am able to run the above command using either PowerShell or CMD and it works reliably for me on Docker Desktop for Windows.
Since the image expects the config data to be persisted, we should probably specify a name for that volume too, like this:
I think just a documentation change is needed to resolve this issue. @junlia can you confirm whether my revised command above works for you?
I am happy to put in a PR with the documentation change once this is confirmed to work outside my environment.
This has been fixed by #5419