Page 1 of 1

Greyhole and MySQL

Posted: Fri May 07, 2010 8:17 am
by robnix
Are there any plans to use MySQL with Greyhole on Amahi in the future? Most of the problems I've run into are due to the r/w locks.

Re: Greyhole and MySQL

Posted: Sun Jun 27, 2010 6:22 am
by gboudreau
I'm personally using MySQL instead of sqlite.
Greyhole was developed using a MySQL backend.
Only the Amahi version of Greyhole uses SQLite.

To use MySQL yourself:

Make sure Greyhole is idle: Make sure that this log file says "Sleeping...":

Code: Select all

tail -f /var/log/greyhole.log
Create the MySQL database & user:

Code: Select all

hda-create-db-and-user greyhole mysql -ugreyhole -pgreyhole greyhole < /usr/share/greyhole/schema-mysql.sql
Edit /var/hda/platform/html/config/greyhole.yml:

Code: Select all

db_engine: mysql # options for mysql db engine db_name: greyhole db_user: greyhole db_pass: greyhole db_host: localhost
Then re-generate greyhole.conf from greyhole.yml: just edit a share location in the Amahi Dashboard, but just hit save without changing the location.

Stop Greyhole: Go in your Amahi Dashboard, in Setup > Settings > Servers, and uncheck the "Watchdog" checkbox for Greyhole, then stop it using the red icon. (You might have to enable advanced settings to see that page.)

Update the MySQL database to prevent Greyhole from re-parsing what it parsed in SQLite:

Code: Select all

fd=`sqlite3 /var/cache/greyhole.sqlite "select value from settings where name = 'last_read_log_smbd_line'"` mysql -uroot -phda -e "update settings set value = '$fd' where name = 'last_read_log_smbd_line'" greyhole
Restart Greyhole from the Amahi Dashboard, and re-enable the watchdog for the service.

PS Sorry about the very late response... I didn't use a Google Alerts for greyhole posts in this forum before today!

Re: Greyhole and MySQL

Posted: Sun Jun 27, 2010 10:18 am
by cpg
I take responsibility for this decision. The feeling was that adding mysql to the dependencies of Greyhole was a bit too much, that it would be more reliably without one extra moving part.

I have lived to regret that decision.

Maybe we can make a small script to set these at the drop of a command?

Also, a note of caution: I am not sure if new platform releases will preserve these settings.

Re: Greyhole and MySQL

Posted: Sun Jun 27, 2010 10:35 am
by gboudreau
From hda-platform.spec:
%config(noreplace) /var/hda/platform/html/config/*.yml

i.e. greyhole.yml will not be overwritten by hda-platform updates, even if the file changed in the RPM.

Re: Greyhole and MySQL

Posted: Thu Jul 15, 2010 9:37 am
by robnix
I'm personally using MySQL instead of sqlite.
Greyhole was developed using a MySQL backend.
Only the Amahi version of Greyhole uses SQLite.

To use MySQL yourself:

Create a greyhole MySQL database:

Code: Select all

hda-create-db-and-user greyhole mysql -ugreyhole -pgreyhole greyhole < /usr/share/greyhole/schema-mysql.sql
Then edit /var/hda/platform/html/config/greyhole.yml:

Code: Select all

db_engine: mysql # options for mysql db engine database: greyhole username: greyhole password: greyhole host: localhost
Finally, restart Greyhole:

Code: Select all

service greyhole restart
PS Sorry about the very late response... I didn't use a Google Alerts for greyhole posts in this forum before today!
Thank you very much. This makes a big difference in my ability to Amahi.

Re: Greyhole and MySQL

Posted: Mon Jul 19, 2010 2:44 am
by whetu
related question from left field - any thoughts of supporting postgres?

Re: Greyhole and MySQL

Posted: Mon Jul 19, 2010 3:24 am
by gboudreau
related question from left field - any thoughts of supporting postgres?
Never thought anyone would ever need or want such a thing. Why?

Re: Greyhole and MySQL

Posted: Tue Jul 20, 2010 4:27 pm
by whetu
related question from left field - any thoughts of supporting postgres?
Never thought anyone would ever need or want such a thing. Why?
Partly curiosity, and partly because it's just been my professional experience that MySQL is a pile of turd :)

In my last three sysadmin jobs I've had to really nurse inherited MySQL systems along, hand tuning its configuration to glean any reasonable performance (mysqltuner.pl is a godsend) and fixing queries that didn't work across versions etc. People think that they just install MySQL and then life will be all rainbows and kittens, but the reality is that it's so shoddy that it needs constant maintenance, and may the IT Gods have mercy on you should you decide to scale it.

On the other hand, every single instance of PostGres I've come across just works (tm) and scales brilliantly, compared to MySQL it's set-and-forget, and the same can be said about the Oracle and MS-SQL systems I've maintained (yeah, you read it: I've had a better time with MS-SQL than MySQL - how depressing is that? :() I don't want to go too far into it as it'd be a thread hijack, but yeah - just be aware that there's a large number of IT Pros out there who, based on experience, have a very dim view of MySQL. Just look at any MySQL/Postgres discussion on slashdot, for example, you'll see them there in the comments.

So I just figured that if people are going to skip sqlite they may as well go for something that doesn't suck. Especially when it comes to anything related to the well-being of their data. Sure, MySQL might be perfectly fine at this level of scale, but I know for sure which RDBMS I'd prefer to trust :)

(Unfortunately I'm only a sysadmin, not a dev nor a full blown DBA - if I could help you out, I'd gladly do it.)