How to save MariaDB's databases? - database

Our hard disk, with Mageia 3, got a bad block problem. We can still read it, but not boot on it. I installed this disk as secondary disk (on another computer working with Fedora 20 Gnome). I would like to save the databases (containing Drupal websites) of the old disk, so I installed mariadb and phpmyadmin packages on a new booting hard disk with Mageia 4, set up the same password as for the old disk (I don't know where MariaDB password is stored), copied the configuration file /etc/my.cnf and the folder /var/lib/mysql to the new disk. But mysqld refuses to start. I get
# systemctl status mysqld.service
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: failed (Result: start-limit) since Wed 2014-03-12 18:08:35 ULAT; 2s ago
Process: 20618 ExecStartPost=/usr/sbin/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 20245 ExecStart=/usr/bin/mysqld_safe --nowatch (code=exited, status=0/SUCCESS)
Process: 20228 ExecStartPre=/usr/sbin/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
Main PID: 20617 (code=exited, status=1/FAILURE)
Mar 12 18:08:35 Dell-graphist systemd[1]: Failed to start MySQL database server.
Mar 12 18:08:35 Dell-graphist systemd[1]: Unit mysqld.service entered failed state.
Mar 12 18:08:35 Dell-graphist systemd[1]: mysqld.service holdoff time over, scheduling restart.
Mar 12 18:08:35 Dell-graphist systemd[1]: Stopping MySQL database server...
Mar 12 18:08:35 Dell-graphist systemd[1]: Starting MySQL database server...
Mar 12 18:08:35 Dell-graphist systemd[1]: mysqld.service start request repeated too quickly, refusing to start.
Mar 12 18:08:35 Dell-graphist systemd[1]: Failed to start MySQL database server.
Mar 12 18:08:35 Dell-graphist systemd[1]: Unit mysqld.service entered failed state.
Or is it better, in my Fedora computer, to configure MariaDB to read the old disk databases and to produce a .sql file? If so, how to configure MariaDB for this ?
Thank you if you can help.

biz -- I think you can try to do the dump following this method:
MYSQLDUMP without the password prompt
If you have access to the file system and server, you can use dump to put the database stuff some where ready for recovery.
I'm not sure if this approach also works when starting the daemon. It is worth a try if you are still wanting to save your stuff.
Another less 'interesting' option is to do a deep copy of the whole mysql/mariadb folder. You need to change ownership of the target folder after copying to be "mysql:mysql" and change your mysql config to point to the new location.
Use start and see if the server will come-up on the cloned directory? You may still find problems on some queries if there's a hole in the (origin) disk. Either way you ought to be able to just dump to a text file stream as long as you get a server working.

Related

zfs legacy mounts on Ubuntu 18.04

I'm using zfs on a generic Ubuntu 18.04 system. Everything works fine when creating and mounting file systems using normal mountpoints.
However, I have a use case that would be helped if I could use legacy mounts that auto mount at boot time.
If I set my legacy mount as noauto and then manually mount after startup, everything works fine.
But when I remove noauto, I fail to automatically mount at boot. It's obvious what the problem is - during startup the attempt to mount the drive is taking place before the ZFS modules are loaded:
$ systemctl status home-vagrant.mount
● home-vagrant.mount - /home/vagrant
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Thu 2020-04-30 11:41:07 PDT; 24s ago
Where: /home/vagrant
What: vagrant
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Process: 464 ExecMount=/bin/mount vagrant /home/vagrant -t zfs (code=exited, status=2)
Apr 30 11:41:07 ubuntu mount[464]: The ZFS modules are not loaded.
Apr 30 11:41:07 ubuntu mount[464]: Try running '/sbin/modprobe zfs' as root to load them.
Apr 30 11:41:07 ubuntu systemd[1]: home-vagrant.mount: Mount process exited, code=exited status=2
Apr 30 11:41:07 ubuntu systemd[1]: home-vagrant.mount: Failed with result 'exit-code'.
Apr 30 11:41:07 ubuntu systemd[1]: Failed to mount /home/vagrant.
Of course, later in the boot process the ZFS modules are loaded and it can be mounted properly. I can see the two events in the boot printout, it's pretty obvious what the problem is - but not the fix.
I haven't been able to find a simple how-to for dealing with this. From what I can see, it seems like installing zsh-initramfs is supposed to help with this - but how?
What little information is floating around out there seems to primarily deal with using zsh for the root file system, and in many cases that is a lot more complicated.
Part of the use case might clear up why I want legacy mounts - I have bind mounts that are being mounted in the ZFS file system. So a workaround would be to use links instead of mounts - and if I can't solve this problem that's what I'll do.
But it seems like this should be doable!
One possible workaround is to load zfs kernel modules in your initrd.
I'm not sure about Ubuntu, but on CentOS/Fedora, you could add a script to /etc/sysconfig/modules that executes really early on, as soon as the rootfs is mounted. You may want to look at whether there is an analogue in Ubuntu.

Ubuntu mssql server Corruption detected in persistent registry: \SystemRoot\security.hiv

I started having this issue today on our production sql server. I have tried a variety of different fixes proposed online. We are using MSSQL server 2017 (14.0.3257.3-13). I'm out of ideas on what could be causing the server to crash. Below is the recent crash log.
This program has encountered a fatal error and cannot continue running at Sat Feb 1 14:21:21 2020
The following diagnostic information is available:
Reason: 0x00000007
Status: 0xc000014c
Message: Corruption detected in persistent registry: \SystemRoot\security.hiv.
Stack Trace:
000000006b137250
000000006b1345bf
000000006b1347a3
000000006b1337d3
000000006b1326f2
000000006b175c31
Process: 8815 - sqlservr
Thread: 8819 (application thread 0x4)
Instance Id: e5a2f812-0426-4d92-b9b2-1db1e60d957c
Crash Id: 60073e70-4042-4275-9fcd-a05ae84d26f5
Build stamp: 9726a6583fe7826f57b03fd1c7adf12bebe7692cb64630fccb0541c06820af4d
Distribution: Ubuntu 16.04.6 LTS
Processors: 9
Total Memory: 8589934592 bytes
Timestamp: Sat Feb 1 14:21:21 2020
Last errno: 2
Last errno text: No such file or directory
Thank you for the ideas, Toret.
I have faced the same issue, but I solved it just by deleting the security.hiv file.
rm /var/opt/mssql/.system/system/security.hiv
After that the mssql-server service started normaly.
After working through multiple proposed solutions online nothing worked. Some of the things I tried:
Upgrading mssql-server to latest version.
Repairing missing files or dependencies.
Changing access permissions to the directory.
Elevating access permissions for the mssql user.
Changing user access to root for the .hiv files located in the mssql .system/system folder
The only way to for me to get it to work was to:
Delete all the folders manually from /var/opt/mssql/ except for the
data folder.
Re-link python from 3.5 to 2.7
Then I downgraded the mssql-server version to Microsoft SQL Server 2017 14.0.3192.2.
Run the sudo /opt/mssql/bin/mssql-conf setup
**Python Re-link**
sudo rm /user/bin/python
sudo ln -s /user/bin/python[version] /user/bin/python
After that everything worked again.

Running Solr with SystemD: user limitations (ulimit) applied at runtime different from the configured limitations

I'm trying to run solr as a SystemD service. When I start the service I get this warning then the solr server stops.
jun 22 16:20:07 solr_start[1488]: *** [WARN] *** Your Max Processes Limit is currently 14972.
jun 22 16:20:07 solr_start[1488]: It should be set to 65000 to avoid operational disruption.
jun 22 16:20:07 solr_start[1488]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
jun 22 16:20:09 solr_start[1488]: Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require
jun 22 16:20:09 solr_start[1488]: RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'.
jun 22 16:20:14 solr_start[1488]: [146B blob data]
jun 22 16:20:14 solr_start[1488]: Started Solr server on port 8983 (pid=1579). Happy searching!
jun 22 16:20:15 solr_stop[1680]: Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 1579 to stop gracefully.
I checked the code at https://github.com/apache/lucene-solr/blob/master/solr/bin/solr#L1509.
I can see that solr runs a check on ulimit -u and ulimit -n.
The strange thing is that I made sure SystemD would run the solr server with the "solr" user.
[Unit]
Description=Apache SOLR
After=syslog.target network.target remote-fs.target nss-lookup.target systemd-journald-dev-log.socket
Before=multi-user.target
[Service]
User=solr
#PIDFile=/mnt/solrdata/solr-8983.pid
Environment=SOLR_INCLUDE=/opt/solr/bin/solr.in.sh
ExecStart=/opt/solr/bin/solr_start
ExecStop=/opt/solr/bin/solr_stop
#Restart=on-failure
[Install]
WantedBy=multi-user.target​
And this "solr" user (that I configured especially to run Solr server) can create an unlimited number of processes and open an unlimited number of files.
[solr#xxx ~]# ulimit -n
unlimited
[root#xxx ~]# ulimit -u
unlimited
When SystemD starts solr I see it uses the correct user (the "solr" user I configured). Yet I see the error above.
When I run solr directly with the "solr" user (no with SystemD), it works.
Why are the user limitations applied at runtime when I run the Solr server myself different from the ones used when run by SystemD ???
According to this limit defined in /etc/security/limit.conf dosen't work with systemD.
To define new limit in a systemD unit file add those line in the service section:
LimitNOFILE=65000
LimitNPROC=65000
For a complete list see the man page

Failed Start for Microsoft SQL Server Database Engine on Linux

I have installed mssql on Ubuntu 16.04. following are the details of sql server.
ms sql (14.0.3015.40-1) i.e SQL server 2017.
when I run the configuration command #sudo /opt/mssql/bin/sqlservr-setup
I got error sudo: /opt/mssql/bin/sqlservr-setup: command not found
I have stopped and restarted but of no use.
When I check the status by command #systemctl status mssql-server
I got
mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2018-02-02 16:15:29 IST; 4min 20s ago
Docs: https://learn.microsoft.com/en-us/sql/linux
Process: 28050 ExecStart=/opt/mssql/bin/sqlservr (code=exited, status=200/CHDIR)
Main PID: 28050 (code=exited, status=200/CHDIR)
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Unit entered failed state.
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Failed with result 'exit-code'.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Service hold-off time over, scheduling restart.
Feb 02 16:15:29 chetan-desktop systemd[1]: Stopped Microsoft SQL Server Database Engine.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Start request repeated too quickly.
Feb 02 16:15:29 chetan-desktop systemd[1]: Failed to start Microsoft SQL Server Database Engine.
I have googled and tried all possible options. But unable to start SQL server.
Please guide me through this.
I had the same two problems.
First, I was referencing very old documentation that applied to an early (preview) release for RHEL, and so I was using the wrong command. The correct command is:
/opt/mssql/bin/mssql-conf setup
Second, the service was failing to start because my virtual machine did not have enough RAM available (SQL Server on Linux requires at least 2GiB of RAM available.) The documentation I was referred to incorrectly stated that only 0.5GiB was required, this is incorrect and journalctl was not providing any useful information about the start failure.
After configuring available memory to 2GiB and using the correct mssql-conf command I was able to successfully configure and start an MSSQL Server instance on Linux.
References:
Configure SQL Server on Linux with the mssql-conf tool (Microsoft Docs)
KB052969: FIX: Minimum memory limit set to 2GB to install or start SQL Server 2017 (Microsoft Support)
Installation guidance for SQL Server on Linux (Microsoft Docs)
The error says that the executable wasn't found in this path, not that the service couldn't start.
According to the installation instructions for Ubuntu you need to run mssql-conf setup to configure the server :
sudo /opt/mssql/bin/mssql-conf setup
not sqlservr-setup
Increasing the RAM size to 3GB on my VM resolved the issue for me.

Installing Solr 5 on Debian 8

I followed the instructions on https://ctors.net/2015/07/14/solr5_java8_debian8.
As the root
First I installed Java 8:
mkdir -p /opt/java
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
tar xvf jdk-8u45-linux-x64.tar.gz -C /opt/java
update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_45/bin/java 1
update-alternatives --set java /opt/java/jdk1.8.0_45/bin/java
Then I installed Solr:
wget http://apache.belnet.be/lucene/solr/5.2.1/solr-5.2.1.tgz
tar xvf solr-5.2.1.tgz
./solr-5.2.1/bin/install_solr_service.sh solr-5.2.1.tgz
But the installation ends up with the following error message:
solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr)
Active: failed (Result: exit-code) since Wed 2015-11-18 02:29:36 TMT; 5s ago
Process: 1679 ExecStart=/etc/init.d/solr start (code=exited, status=1/FAILURE)
Nov 18 02:29:36 solrhost su[1681]: Successful su for solr by root
Nov 18 02:29:36 solrhost su[1681]: + ??? root:solr
Nov 18 02:29:36 solrhost su[1681]: pam_unix(su:session): session opened for user solr by (uid=0)
Nov 1`enter code here`8 02:29:36 solruser solr[1679]: This script requires extracting a WAR file with either the jar or unzip utility, please install these utilities or con...assistance.
Nov 18 02:29:36 solrhost su[1681]: pam_unix(su:session): session closed for user solr
Nov 18 02:29:36 solrhost systemd[1]: solr.service: control process exited, code=exited status=1
Nov 18 02:29:36 solrhost systemd[1]: Failed to start LSB: Controls Apache Solr as a Service.
Nov 18 02:29:36 solrhost systemd[1]: Unit solr.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
Service solr installed.
Does anyone have any idea what is going on?
solr needs unzip to work. Install unzip if it isn't available on the system.
apt-get install unzip
It should fix the problem.
I got my colleague to have a look at the issue. He found two causes of error:
1) Insufficient memory (my box had 512 MB RAM memory). Additional memory resolved the issue.
2) Wrong jdk package, that is, wrong architecture choice. For different JDK packages look here: http://www.oracle.com/technetwork/java/javase/downloads/java-se-6u24-download-338091.html.
Hope someday this will save someone else's time and nerves.
As for Debian and Solr developers, it would be great if you could come up with simple receipt about how to install Solr 5 under Debian 8. For example, https://www.digitalocean.com/community/tutorials/how-to-install-solr-5-2-1-on-ubuntu-14-04.

Resources