Storage Node database connection unavailable
-
Hi Guys,
I’ve been using this thing for months and I love it.
This question is now about storage nodes - and maybe because I screwed something up.
So I used to setup my fogserver as a debian with two NIC’s, one for WAN and one for its seperate fogserver DHCP LAN. This was a hassle. After finally messing with 66/67 settings and realizing how easy it is, I went this route.
I migrated my database, images and snapins from one VM running debian to a second machine running mint, setup as a DHCP client with pxe server. This went perfectly fine. I used the guides on here and the wiki to do this. I think I had to copy the snapins myself but ultimately ended up just using the files and re-uploading due to hashes.
So now I’m trying to expand, and have several old model laptops with 80-120-160GB HDD’s that I figured i’d throw debian/xfce on and put as storage nodes. So I installed debian base, with just system utilities and xfce, and downloaded fog, sudo, edited sudoers and ran the installer my first time as storage node.
One thing I was expecting but did not see was the database pause in the setup, when you have to go to the fogserver web console and update the schema. Not sure if it was supposed to, but if it was this is where I figured my issue lied.
So I installed it, ran everything fine, put in the fogstorage//************ into the credentials in the installer script, and all was well. Went on my fogserver and added it as storage, seemed to go fine.
The graphs all show, and list both machines - correctly. Disk usage is correct, Network throughput etc. If you click on the pie graph for fogstoragenode, it brings up the info page but says “A valid database connection could not be made”@@general in table on the right under kernel I think IIRC.
The storage node webserver brings me to a white page after redirecting to IP/fog/management/index.php?node=schema and the text says database connection unavailable.
Some troubleshooting steps I saw in forum posts and the like have me troubleshooting the database connection, so I go on storagenode and type mysql -h localhost -u fogstorage -D fog -p and then enter password, it says error 1049 unknown database fog. So I figured something was wrong there too. I did try to change the password on everything to make sure its all right ( i have that randomized sql password memorized now after typing so many times on server and storage node ) but still no luck. I tried a few other steps too but don’t remember off the top of my head.
I’m wondering if it was supposed to give me the database schema page on the storagenode. If it wasn’t I’ve re-ran the installer several times and deleted the .fogsettings file to make sure it would re-run entirely. I’ve re-ran the installer on the fogserver as well.
My hopes were to make an image for debian with fogserver in storagemode installed, capture it on fogserver, then bring a main fogserver with me to client sites. Bring several e6400’s with me, and deploy the storagenode image on them, re-run installer with new IP scheme, and use the expanded ability to send out more images per site.
-
as a test, I reinstalled a fog server in normal and three more in storage to connect to the new one. this worked fine, and I see how its supposed to work now. I have a feeling my sql is messed up from the transfer from my original to my new server.
-
@p4cm4n A FOG storage node does not use it’s own database but connects to the main FOG server’s database. For that it should create a valid login in your main database and use that on the storage node.
First check to see which credentials are stored in the config on the storage node:
shell> grep "DATABASE_" /var/www/html/fog/lib/fog/config.class.php` shell> mysql -h x.x.x.x -u fogstorage -D fog -p Password: ...
Probably this will fail. Now check to see if credentials were added to the database on the main FOG server:
shell> mysql -u root -D mysql -p Password: mysql> SELECT host,user,password FROM user WHERE user LIKE '%fogstorage%'; +------+------------+-------------------------------------------+ | host | user | password | +------+------------+-------------------------------------------+ | % | fogstorage | *xxxxxxxxxxxxxx3A7F5927C98A86B9E21470F1AB | +------+------------+-------------------------------------------+
-
@Sebastian-Roth
thanks! this helped me to figure out the issue, but don’t know what caused it.
it was not added to the main fog server. unfortunately i did a whole crapload of commands in sql before i checked, so i’m not sure which one was the fix. i did the command you posted above, it said unknown column password in field list.
i then ran
set password for fogstorage (cant find any matching row in user table)
grand all on fog to fog@localhost (cant find any matching row in user table)
create user fog@localhost identified by ‘password’; (query ok, 0/0.0)
create user fogstorage@localhost identified by ‘password’ (query ok, 0/0.0)
create user fogstorage@IP_OF_STORAGE_NODE identified by ‘password’ (error 1396, create user failed for <)at this point i realized caps mattered
GRANT ALL ON fog.* TO ‘fog’@‘localhost’; (query ok, 0/0.05)
GRANT ALL ON fog.* TO ‘fogstorage’@‘localhost’; (ok, 0/0.0)
GRANT ALL ON fog.* TO ‘fogstorage’@‘IP_OF_NODE’; (query ok, 0/0.0)
SET PASSWORD FOR ‘fogstorage’@‘%’=PASSWORD(‘password’); (query ok, 1 warning)now it works as the others were in my seperate setup.
-
@p4cm4n We have seen issues with this lately and I am wondering if there is a bug pending. But on the other hand I cannot replicate this and I have done a couple of storage node installs lately. Please let us know if you have an idea on how this happened. Marking as solved for now.