• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using MariaDB on NetPi
#5
(January-7th-2020, 07:50 AM)Armin@netPI Wrote: Hi there,

what I would recommend to you is using indeed the image https://hub.docker.com/r/hilschernetpi/netpi-raspbian that we prepared for netPI if you use the SD card preinstalled on your fresh netPI. If you do not want to use the default SD card and default image, you can use you own SD card and then you use the very official image from Raspberry.org. In this case using Docker is not necessarily a need. But based on what you wrote in your post you indeed want to use Docker. I do use Raspbian OS with Docker at home too by the way. So are you using the preinstalled SD card or your own.

If you use the container https://hub.docker.com/r/hilschernetpi/netpi-raspbian then this is a Raspbian OS container with Buster made by us . So once you have started this container it you can use it with port 22 and a terminal console (putty) to control it once you have mapped the port 22 during container start.

And yes of course you can use the commands 


Code:
sudo apt-get update
sudo apt-get -upgrade
sudo apt-get install mariadb-server

in our container.

But back to your mariadb. I do not know all details about the mariadb server and how it works. For me it is just a database. But let me ask you this ... does mariadb server have a web socket interface that allows access from remote stations over IP or it is just a local database that can only be used from local applications? I cannot answer this. Please answer this question first.

Thank you

Thanks for your quick reply,

I will try to answer all of your questions accurately.

We are currently using the pre installed SD card that came with the NetPI. We are using docker as we were of the understanding that this is the most practical and secure way of using the NetPi? If the NetPi is intended to be on par with a Rasp Pi 3, wouldn't it just be easier to just load raspberry.org image in all cases? (I'm sure this isn't correct but can you explain why?)

 We want to use the raspberry Pi for development. If I pull the hilschernetpi/netpi-raspbian docker image on the raspberry pi. How do we access this container? My current process is this:

Using Putty from my windows 10 pc:
  • Connect to the IP of the Raspberry Pi
  • Login with user: pi PWD: raspberry
Code:
sudo docker images


returns:

REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
hilschernetpi/netpi-raspbian   latest              bdc724e92997        4 days ago          801MB
mariadb/server                 10.3                d1ed196aa600        3 weeks ago         345MB

Code:
sudo docker ps

returns:
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Code:
sudo docker run -i -t hilschernetpi/netpi-raspbian /bin/bash

returns:
starting ssh ...
[ ok ] Starting OpenBSD Secure Shell server: sshd.
starting dbus ...
[ ok ] Starting system message bus: dbus.

This is as far as I get and can't access the container, what am I missing?

On the NetPi I can access the container via SSH.


Quote:I have another question. Why do you want to use mariadb as database? Is there a reason?

Also I want to mention that using a database on SD cards is always critical in terms of limited write cycles of SD card memory. Please read this thread: https://forum.hilscher.com/Thread-SD-card-duration first to understand the problem.

If you intend to run a database on netPI I strongly recommend to use another type of SD card with other technology like pSLC or SLC or an SD card of higher density.

P.S.: By the way I agree that the FAQ is little outdated and needs an update.

I was using MySQL, however raspbian buster uses MariaDB by default. It is a local database that can be accessed remotely over IP. The idea behind this is running the local database on the NetPi which records the information in real time, a replication MariaDB server is running on Microsoft Azure. When the NetPI has an active internet connection it syncs with the Azure database. 

The data that is being recorded is vessel telemetry (GPS location, speed, engine data etc...) The data needs to be recorded for approx 30 days.

It is noted about the write cycles for these SD cards. Im not sure how to get around this issue as the vessel will not always have an internet connection. So while it is out of range it needs to record the information somewhere. If it had a constant internet connection we could just connect directly to the azure server.

Do you have any other suggestions for recording telemetry on the NetPi?

Quote:I read this article https://mariadb.com/kb/en/configuring-ma...nt-access/ carefully.

I understood that mariadb server supports client access from remote stations once it is enabled. I read that the default port in use is port 3306.

So if you want your PC to access the netPI mariadb container over TCP/IP then you have to "open" the port 3306 in the container. This is done using the "port mapping" feature used while a containe is started. It is the same like the port 22 to enable the console connection, but now for port 3306 for mariadb access from remote.

Since you are new to docker: port mapping can only be setup during the first container start. It is never ever possible to "open" other ports while a container is running. So all applications that will run in future in a container and their used ports need to be known from the beginning and handed over to Docker container start parameter.

This makes sense and I will try this today.

Can I stop a running container and open the port and reopen it? Or do I reinstall with the port mapping?

For arguments sake, If I were to have a container running on the NetPi with the local MariaDB server, if the NEtPi were to lose power and restart. When the NetPi restarted would this container lose all data in the MariaDB server?

I appreciate your time and effort with this.
  Reply


Messages In This Thread
Using MariaDB on NetPi - by philump - January-7th-2020, 05:52 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-7th-2020, 07:50 AM
RE: Using MariaDB on NetPi - by philump - January-7th-2020, 10:04 PM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 07:42 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 07:55 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 08:06 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 08:12 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-7th-2020, 08:29 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-7th-2020, 08:46 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 07:27 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 08:21 AM
RE: Using MariaDB on NetPi - by philump - January-8th-2020, 11:52 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-8th-2020, 12:14 PM
RE: Using MariaDB on NetPi - by philump - January-8th-2020, 09:41 PM
RE: Using MariaDB on NetPi - by philump - January-9th-2020, 12:01 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-9th-2020, 06:36 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-9th-2020, 06:39 AM
RE: Using MariaDB on NetPi - by philump - January-10th-2020, 07:17 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-10th-2020, 07:51 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-10th-2020, 07:57 AM
RE: Using MariaDB on NetPi - by philump - January-13th-2020, 02:55 AM
RE: Using MariaDB on NetPi - by Armin@netPI - January-13th-2020, 06:47 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)