This message was deleted.
# troubleshooting
s
This message was deleted.
s
This is odd. I will try to test this myself and let you know what I find. In the meantime, as a workaround, if you configure a quickstart configured to point to postgres DB and you just start the stand-alone Druid, it will create the metadata tables.
I was able to make the metadata-init tool work. I had to fiddle with the command to do it a bit:
Copy code
java -classpath "lib/*" -Dlog4j.configurationFile=conf/druid/cluster/_common/log4j2.xml -Ddruid.extensions.directory="extensions" -Ddruid.extensions.loadList="[\"postgresql-metadata-storage\"]" -Ddruid.metadata.storage.type=postgresql -Ddruid.node.type=metadata-init org.apache.druid.cli.Main tools metadata-init --connectURI="jdbc:<postgresql://localhost:5432/druid>" --user druid --password diurd --base druid
I had to: • change the quotes around the loadList value • add the -Ddruid.node.type=metadata-init. (this is so that the log file is created with the name "metadata-init.log" instead of the "${druid.node.type}.log" šŸ˜„, this helped me troubleshoot by looking at the log once I found it • My connectURI parameter was also wrong initially, and I think you may also have the wrong format
I'll update docs
s
@Sergio Ferragut, I was able to create the tables using metadata-init tool. Then I imported data for audit, rules, segment & task tables from derby to pg instance using dbeaver table data import utility. All the 4 metadata tables in PG now has same data as derby tables. After moving the data I changed my common.runtime.properties to connect to PG instance in all 4 nodes. Restarted all the services in order of master > data > query. UI is working, in services tab all services are up. However my segments and task tabs shows empty in UI. Its like fresh new druid. How can I retain all my data as is from Derby DB to PG db without impacting the UI ?
s
Did you copy the data in the druid_segments table? That's the one that contains the Deep Storage references.
The only change was the metadata repository?
s
Yes. I copied the druid_segments table data also as is. And only change was the MD repository. When i switch back to earlier derby DB, my segments and tasks show up as it was left, only change is the segments start getting downloaded from deep storage to history node automatically.
s
can you log in to postgres cli and just do a
SELECT count(*) FROM druid.druid_segments
s
Yes. It is working that way
s
Do you see the count that you expect?
s
I cross checked the data across Derby and PG. It all matches
s
Could you also check it with
SELECT used, count(*) FROM druid.druid_segments GROUP BY 1
s
It has gone onto druid DB, public schema though. bcz the metadata-init tool created the tables on public schema
Do I need to create a druid schema manually in the DB and then run the metadata-init to create it inside druid schema ?
s
I'm not sure. But was there a druid schema created automatically when you restarted the master node? does it contain these tables. That may be another missing step in the metadata init, I'm not certain.
s
I checked both the ways. using init tool as well as passing the PG URI in runtime config and restarting the services. But in both the cases it created the tables in
public
schema, instead of creating a druid schema automatically or failing the script in case there is no druid schema.
Let me try to copy everything into a manually created
druid
schema and refresh my UI to see if it has any effects
s
Sounds good. Also take a look at
druid.metadata.storage.tables.base
it isn't clear to me but perhaps this is the "schema" name. https://druid.apache.org/docs/latest/configuration/index.html#metadata-storage
s
I did provide druid as that value. But I think it represents database
šŸ‘ 1
s
It is still interesting to see the count grouped by "used" column, just to check if the coordinator marked the segments as unused at some point. That could have happened if the default retention rule on the new metadata was "dropForever" for some reason. Did you copy the
druid_rules
table as well? What are the current retention rules?
s
This is the result of the grouped by sql - used, count false, 8 true, 573
Rules was set to dropNever. However I can check the old values
s
good. so it does have published segments and the retention rule theory is out. the used=true segments are what drive the coordinator/broker timeline map. So this must just be about pointing at the right set of tables. Let me know how the "druid" schema test goes, but I'm doubting that is the issue.
Rules was set to dropNever. However I can check the old values
I don't recognize "dropNever", did you mean "loadForever" ?
s
Ya. Sorry. "loadForever"
s
In the coordinator log you should see messages like
Copy code
Polled and found 573 segments in the database
Do you see that?
s
While checking the logs, it looks like it is not able to read the data from the payload column of segments & tasks table. Let me try to re insert the data from the bkp files and check back.. Thanks for all the help buddy !
s
Perhaps an encoding issue between your source and target? payload should be encoded the same way, utf-8 is the default. Perhaps your postgres setup needs that explicitly when creating the database:
createdb --encoding=UTF8 ....
BTW. I found where the schema is configured. it is
druid.metadata.postgres.dbTableSchema
and defaults to
public
.
s
Re copied the data from CSV to PG. And this time it worked. Thanks for all the help.. šŸ™‚ Is there a way to also export tasks table from Derby inorder to import into postgress ?
If not available by the export-metadata library, we can try some other way to export data as csv and then import into postgress.
s
druid_tasks holds task status information which you can also copy if you want to keep the history of task execution, but I don't think it is necessary.