Hello everybody,
I am at the luxurious position that I have two locations at my qth where I can play with my radio's :-D
At both positions I have laptop's running CQRlog. To keep the log complete (and not having two different ones) I have setup a small Raspberry Pi server with an instance of CQRlog installed, which runs 24/7. This is the master log database. The other laptops connect to this instance of CQRlog. That works fine, now both laptops show all contacts, regardless if they were made in the attic shack or in the garden shack.
There is one issue, however. On one of the locations I have a serial connection to the rig (FT857) to get the mode and frequency correct. If I set this up on the connected computer however, the moment the Raspberry is restarted (or the CQRLog instance running on that machine), the interface settings are reset to their defaults.
Any idea how to circumvent this?
73
Peter/PA3FQH
Hi Peter!
If I understood ok your raspi does not actually connect to any rig and usage of cqrlog GUI happens always from laptops.
So why not run just mysql(mariaDB) server at rasblerry. No need to install cqrlog to it at all.
Just install cqrlogs to laptops and at start "Database connection" window select raspberry IP and port 3306 as database server and do not check "save data to local machine".
Yo need to allow raspi mysql server database access for cqrlog(s). See this message: https://www.cqrlog.com/comment/6776#comment-6776
That way you have just one database. Then open preferences/Program and push "configuration storage" button and select what values are saved at local laptop and what goes to common database.
That way you can have common database for logs and separate settings for every PC (and rig) that connects to common logs.
--
Saku
OH1KH
Hi Saku,
Thanks for the answer.
Well, that was my idea in the first place, but I didn't know how to do this. So I found the easiest way was to just install CQRLog on the RPI and that seemed to work.
BTW, I was not aware of the 'configuration storage' button, that seems at least to do what I want. I can make the rig settings only on the specific laptop. I was affraid that allways all settings were replicated to the database on the RPI, and retrieved from there by all 'slave' laptops.
But then again, I am not very experienced with databases on linux, so I don't have a clue how to set this up as you describe. I guess the database tables must be copied in one way or another to the RPI. At this moment, when CQRlog is not running on the RPI, the CQRlog on the laptop will not initialize correctly, as it can't find the database (which is strange, as the sql server is still running).
A howto for ordinary users (i.e. not being a database guru) would be very welcome.
73
Peter/PA3FQH
Ok Peter!
Your RPI has mysql installed if Cqrlog runs ok.
Open console for RPI and give:
sudo mysql
You get something like:
MariaDB [(none)]>
Then write line:
GRANT ALL PRIVILEGES ON *.* TO 'cqrlog'@'%' IDENTIFIED BY 'cqrlog';
You will get response like:
Query OK, 0 rows affected (0.04 sec)
Then type:
quit
Find file /etc/mysql/my.cnf and open it to edit with sudo
sudo nano /etc/mysql/my.cnf
Find line "bind-address" and check that it has RPIs network IP address. (not 127....)
save file
restart RPI
If RPI and/or laptops use firewall you must allow port 3306 to whole your local network (how to do that depends what firewall you are using. Seek help from Google)
You can also read this for better instructions: https://howtoraspberrypi.com/enable-mysql-remote-connection-raspberry-pi/
Next try to open RPI cqrlog and in database selection uncheck "save data to local machine". Change port number to 3306.
Address is sameRPI network address username and password both cqrlog.
Try to connect with connect button. Check remember me and auto connect.
If that works you can try to make a new log.
If it works you can try to connect with laptop. First close RPI cqrlog (to be sure laptops connect to real mysql server)
Then open laptop cqrlog and in database selection uncheck "save data to local machine". Change port number to 3306.
Address is RPI's network IP address,username and password both cqrlog.
Try to connect. Check remember me and auto connect.
If it connects you will see the log you just made with RPI.
You could move log from RPI local machine to RPI mysql server with console and mysqldump command, but it might be easier to make full adif export and then import it to that new log.
When all this works RPI does not have cqrlog at all. At least running. For testing it could be handy to have it installed.
It is quite long time since I made this, so might be that I forgot something. But we take one step at time and see if errors arise.
--
Saku
OH1KH
Thanks for this, Saku,
To be honest, I first changed the TRX control to Local computer only. This works for me, and was apparently the setting I had overlooked.
Further I don't see a reason to change the setup, as long as this keeps working stable (to be verified over the coming weeks, but the first experience is positive).
Just running the CQRLog program on the RPI seems the simplest solution. As the RPI is quite cheap, and does not consume a lot of power, I can easily afford having this run for the sole purpose of the log database server. I don't really care that this may be a bit overkill. The procedure you describe is not very clear to me. For instance, what does the command "GRANT ALL PRIVILIGES..." do? Will this set certain properties? E.g. like CHMOD?
This gave the result as indicated (but I am puzzled why it should return "0 rows affected". My initial conclusion would be that it hadn't done anything (either positive or negative).
But the next step failed. The file my.conf does not contain a line 'bind-address". At this point I decided to leave it for now, as it is now working as I wanted to.
Once again, thanks for your help
73
Peter/PA3FQH
Hi Peter !
The solution that works is usually the best !
How ever I am a bit curious how you do it now?
You run cqrlog on RPI and say i is your master database. Then, if understood, you use laptops at radios and log your qsos there.
I assume you have home network. Either wired or WiFi between your laptops and RPI.
I wonder how qsos then go to RPI log?
As you need local config for laptops you cannot use remote desktop (vnc viewer) to get RPI desktop to your laptop screen.
That leaves one solution left: You share RPIs directory with file sharing and symlink RPI's ~/.config/database directory to laptops~/.config/database.
But that sounds quite complicated if you say you are not very experienced. But concerns that only databases?
The GRANT ALL... is a MYSQL command. It is really releative to bash command chmod. In format I wrote it it is "wide open" to whole database server, but if it runs only log databases it does not matter.
Good side in this is that you can continue trying to set up remote mysql while still keeping your present system running without touching it.
The link to rasberrypihowto.com is quite good explanation how this happens.
Just replace the GRANT ALL line with one I sent.
If you do not find bind-address line at all, no worry, in example it is commented out with #. So it is the same as not having it at all.
When you have followed instructions just check that RPI and laptop firewalls are open for port 3306 for local network
Then you can test it by change of cqlog's Database connection and create new long. If it works....good. If it needs more testing just change "database connection" settings back and you existing system works again. No QRT!
I add a picture where I have connected to my mysql server from hamshack laptop via WiFi
File:
--
Saku
OH1KH
Hi Saku,
Well, it is actually surprisingly simple.
I just installed CQRlog on the RPI, and selected the tickmark 'Save log data to local machine'.
Then I created a database file on the RPI.
The next thing I did was to modify the database connection on the laptops. I unchecked this tickmark, and filled in the name of the RPI in the 'Server name' field, connected to the database, checked the tickmark 'Remember me' and selected the database file that was presented. (checked the tickmark 'Open recent log after program start')
That's all.
No other tweaks were needed to get this to work.
All machines are in the same (wifi) network, so I don't have to use an external network or VPN or something like that.
73
Peter/PA3FQH
Oh!
I did not understand that the mysql_save thread bleeds to network. I was thinking that separate mysql_save thread works only via localhost in same PC.
OK. So you did make wide open mysql server without knowing it, hi. That makes things easy, but is a security hole. (that does not matter a lot in this case)
Perhaps you could stop the system mysqld.service (or Mariadb.service if that is installed to RPI) and set it not to start at boot. As it is a second instance of database server(in this case) and just eats memory.
sudo systemctl stop mysqld.service #(or Mariadb.service)
at RPI console. If everything still works then
sudo systemctl disable mysqld.service #(or Mariadb.service)
Also cqrlog on RPI eats memory. But it is needed so that laptops can connect.
Actulally not! I think....
I started cqrlog debug=1 from console and checked "save data to local machine". At checking time I saw mysql_save starting at debug.
I picked up those lines to editor and removed linefeeds so that it made only one line:
/usr/bin/mysqld_safe --defaults-file=/home/saku/.config/cqrlog/database/mysql.cnf --datadir=/home/saku/.config/cqrlog/database/ --socket=/home/saku/.config/cqrlog/database/sock --port=64000
Entering this to console starts mysql_safe thread and I think (tested just with telnet) that is all you need. No need to start cqrlog itself at all on RPI.
# Do not use the privileges mechanisms
skip_grant_tables
found in ~/.config/cqrlog/database/mysql.cnf removes the need of "GRANT ALL"-command that is needed in system mysql server that has tighter security.
So dropping of system mysql server and cqrlog releases quite lot of RPI memory.
Try it! (remember backups!)
--
Saku
OH1KH