Mysql Incremental Backup is a complete incremental backup script for MyISAM and InnodB databases using the MySQL binary log so that the backup process does not affect running databases. This tutorial describes the installation of the MysqlIncrementalBackup script and helps to troubleshoot issues that may arise during setup.
Last week, I wrote about how to use bash
arrays and the MySQL
database to create unit and integration test scripts. While
the MySQL example was nice for some users, there were some others
who wanted me to show how to write bash
shell
scripts for Oracle unit and integration testing. That’s what this
blog post does.
If you don’t know much about bash
shell, you should
start with the prior post to learn about bash arrays,
if-statements, and for-loops. In this blog post I only cover how
to implement a bash
shell script that runs SQL
scripts in silent mode and then queries the database in
silent mode and writes the output to an external file.
I’ve copied the basic ERD for the example because of a request from a reader. In their opinion it makes cross referencing the …
[Read more]Student questions are always interesting! They get me to think and to write. The question this time is: “How do I write a Bash Shell script to process multiple MySQL script files?” This post builds the following model (courtesy of MySQL Workbench) by using a bash shell script and MySQL script files, but there’s a disclaimer on this post. It shows both insecure and secure approaches and you should avoid the insecure ones.
It seems a quick refresher on how to use arrays in
bash
shell may be helpful. While it’s essential in a
Linux environment, it’s seems not everyone masters the
bash
shell.
Especially, since I checked my …
[Read more]
Fedora comes with vim
and gedit
installed but the gedit
installation is bare bones.
You can update gedit
to include supplemental
Plug-ins with the following yum
command as the
root
user:
yum install -y gedit-plugins |
It generates the following log file:
Loaded plugins: langpacks, refresh-packagekit mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql56-community | 2.5 kB 00:00 pgdg93 | 3.6 kB 00:00 updates/20/x86_64/metalink | 14 kB 00:00 updates | 4.9 kB 00:00 … |
The fsfreeze command, is used to suspend and resume access to a file system. This allows consistent snapshots to be taken of the filesystem. fsfreeze supports Ext3/4, ReiserFS, JFS and XFS.
A filesystem can be frozen using following command:
# /sbin/fsfreeze -f /data
Now if you are writing to this filesystem, the process/command will be stuck. For example, following command will be stuck in D (UNINTERUPTEBLE_SLEEP) state:
# echo “testing” > /data/file
Only after the filesystem is unfreezed using the following command, can it continue:
# /sbin/fsfreeze -u /data
As per the fsfreeze main page, “fsfreeze is unnecessary for device-mapper devices. The device-mapper (and LVM) automatically freezes filesystem on the device when a snapshot creation is requested.”
fsfreeze is provided by the util-linux package in RHEL systems. Along with userspace support, fsfreeze also …
[Read more]While I previously blogged about installing Netbeans 8, some of my students would prefer to use the Eclipse IDE. This post shows how to install and configure Eclipse IDE, include the mysql-connector-java.jar, and write Java to access the MySQL.
You can download Eclipse IDE and then open it in
Fedora’s Archive Manager. You can use the Archive
Manager to Extract the Eclipse IDE to a directory
of your choice. I opted to extract it into my
student
user’s home directory, which is
/home/student
.
After extracting the Eclipse IDE, you can check the
contents of the eclipse
directory with the following
command:
ls -al eclipse |
You should see the following:
… |
There are tools like pt-kill from the percona tool kit that may
print/kill the long running transactions at MariaDB, MySQL or at
Percona data instances, but a lot of backup scripts are just some
simple bash lines.
So checking for long running transactions before the backup to be
executed seems to be a step that is missed a lot.
Here is one line that might be just added in every bash script
before the backup to be executed
Variant 1. Just log all the processlist entries and calculate
which ones were running longer than TIMELIMIT:
$ export TIMELIMIT=70 && echo "$(date) : check for long runnig queries start:" >> /tmp/processlist.list.to.kill && mysql -BN -e 'show processlist;' | tee -a /tmp/processlist.list.to.kill | awk -vlongtime=${TIMELIMIT} '($6>longtime){print "kill "$1";"}' | tee -a /tmp/processlist.list.to.kill
Variant 2: Log all the processlist, calculate the calculate which processes are …
[Read more]Some of my students want to use the Fedora image that I built for my database classes in my Java software development life cycle course. As a result, they wanted a Java development environment installed. I examined JDeveloper 11g (11.1.1.7.0) and 12c (12.1.3) but resolved on the more generic Netbeans 8 (8.0.2) IDE.
JDK 7 with Netbeans 8 Download
You can download the generic Netbeans 8 IDE, the JDK 7 with Netbeans, or the JDK 8 with Netbeans for the Linux installation. After you download the executable program, you should follow these instructions to install the Netbeans 8 IDE on Fedora.
As the …
[Read more]Introduction
Systemd is a management and configuration platform available in all major Linux distributions. It provides infrastructure for service start, stop, restart and several other novel functionalities to manage services. Systemd replaces SysV and upstart initialization systems and is the default init system in most modern Linux distributions including Red Hat Enterprise Linux, Oracle Linux, Debian, Ubuntu, Fedora, SLES and openSUSE.
Preliminary support for systemd was introduced in earlier versions of MySQL. However, it had the following limitations and disadvantages:
- Use of ping tricks to check whether mysqld is ready to serve client connections.
- Though systemd had superior process control for automatic restarts, mysqld_safe was still used to identify abnormal mysqld termination and do automatic restarts. …
One of my students requested an option to the bash
shell. It was interesting to
hear that he wanted me to instal the zsh
in my Fedora image. There’s only
one book that I’m aware of that’s been published on the Z Shell,
and it is From Bash to Z Shell.
This post shows how to add the zsh
to my Fedora
image because I already release a new one for the term without
the zsh
shell. You use the yum
utility
as the root
user to install the zsh
library:
yum … |