licoffe / POE-Stash-indexer-NG

High performance Path of Exile stash indexer
MIT License
43 stars 12 forks source link

write_parsed_to_file permissions #7

Closed PaulBenn closed 7 years ago

PaulBenn commented 7 years ago

Hey there,

I noticed every time write_parsed_to_file happens the indexer displays "Could not write to file" and just continues. The speed of my inserts is down to an average of 41/s after half an hour running. Just in case, I tried to chmod all 4 folders it uses (which I created manually) to 777, then chowning them to the mysql user and group, but of course this doesn't look to be the right solution. What permissions exactly do I have to use or, if this is caused by something else, what do I have to change? All other tables are being populated correctly. (Also, my data dir is set do /var/lib/mysql which is the default for Linux - as far as I can see this is only used for these 4 tables, can I safely change it to something like the home directory or will that screw up the periodic database inserts?)

Thanks in advance.

By the way, really useful tool. Love it :)

licoffe commented 7 years ago

Hi Paul,

Thank you for using this tool ! :) The indexer should be writing files in the mysql data dir. From the MySQL command line, you can check the data dir location using the following command SHOW VARIABLES WHERE Variable_Name LIKE '%dir'" (lookup for the value of the datadir entry). To this output you should add "/POE" or the name of the database used to store the data if modified in the config.cfg file. Could you compare this output to the DB_DATA_DIR entry in the config.cfg file ? For example, on my side it is set to /home/mysql/POE. I will update the documentation, since this is not clear.

PaulBenn commented 7 years ago

Hi! Just checked MySQL datadir variable, which on my Linux system is in fact /var/lib/mysql. Should DB_DATA_DIR be equal to /var/lib/mysql/POE then? As far as I know the program cannot write to this directory!

licoffe commented 7 years ago

Should DB_DATA_DIR be equal to /var/lib/mysql/POE then?

Yes, exactly, the DB_DATA_DIR should be /var/lib/mysql/POE in your case.

As far as I know the program cannot write to this directory!

The program permissions are bound by the permissions of the user running the program. If you give writing rights to the mysql group on the /var/lib/mysql/POE folder and then add the user running the program to the mysql group, you should be fine. This can be done this way:

chmod 730 /var/lib/mysql/POE usermod -a -G mysql userName

PaulBenn commented 7 years ago

Just tried those two commands. Still geting the same message: could not write to file - do you think running program as root or chmodding to 777 will help?

licoffe commented 7 years ago

You may have to to logout the user and login again to have modifications applied. Root will work, you may try with 777 as well.

PaulBenn commented 7 years ago

Right just tried as root user and it worked. Getting message "[mod_loop] Inserting x batch (1 to go)" the 4 times (I'm assuming this is the intended behaviour). Thank you so much for your help!

licoffe commented 7 years ago

I'm really glad you got it working! :) It would be safer to use a less privileged user than root for security reasons though.