Using a database to store information is very common. The more information gets stored in a database, the more critical it becomes. At a certain point, the need for a redundant, high(er) available database-setup raises. When you’re using PostgreSQL, you can setup streaming replication quite easily in order to have your data redundant on two or more nodes. But wouldn’t it be a shame if you wouldn’t use the copies of your data to balance the load of your primary database-server? In this post, I’ll try to explain how to setup a redundant PostgreSQL database with load balancing.
Tips & tricks for Ansible
Ansible is a very powerful configuration management tool. It can be used to deploy settings and software to one or more (virtual) machines. Using a CM-tool ensures that every deployment is done in exactly the same way. This doesn’t only make your job as a system engineer a whole lot easier, it also results in a more stable environment since every machine is consistent and more predictable. I’m using Ansible intensively for quite some time now and found that it was time to write a post about some small, but usually hard to find or annoying to solve, problems or challenges.
Complile and use a realtime kernel on CentOS 7 or RHEL 7
While the need for a realtime kernel or kernel-rt hasn’t been very high recently, there are these special cases where you really need one. A “standard” linux kernel is fast but also balanced in order to treat all workload fair and give each kind of task an equal share of the system resources. A realtime kernel allows you to squeeze that extra bit of performance out of the kernel. It basically allows you to tune it in a more aggressive way in regards to timing and priorities. Since I couldn’t find any clear instructions on how to get a realtime kernel for CentOS 7 and RHEL 7, I decided to write them myself.
Install and use Spacewalk 2.4 on CentOS 7 and RHEL 7
Spacewalk is the upstream-project for Redhat Satellite. It’s a tool which is mainly used to list, deploy and manage packages and updates to Fedora, CentOS, SLES and even Debian installations. Recently a new version, 2.4, came out, so let’s have a look at the installation procedure and how to perform some basic Spacewalk actions
Install oVirt on CentOS 7
Recently, as you could see in previous posts, oVirt got to my attention. oVirt is the upstream project of Red Hat Enterprise Visualization or RHEV. While oVirt it isn’t providing everything that competitor VMWare ESXi does, it comes close and is a very good alternative for smaller or home setups. For a long time, oVirt wasn’t supported on Enterprise Linux 7 (like RHEL 7 or CentOS 7) but since a short time it is. Here you can find how to install oVirt and get started.
Install the Cinnamon desktop environment on CentOS 7
As you might know, Linux is everything about diversity. With the numerous desktop environments available nothing is different in that area. Besides Mate and XFCE, Cinnamon is one of my favorite desktop environments on Linux. Honestly, I can’t really choose. Cinnamon is fast, (not too) fancy, customizable and familiar in some way. Here is how to install Cinnamon on a fresh minimal CentOS 7 installation.
Create a PXE bootserver to install multiple Linux distributions
When regularly installing Linux hosts or VM’s, it easily becomes annoying to constantly burn CD’s/DVD’s or mount ISO’s for all the Linux distributions that you want to deploy. Especially if you want to keep them current or customize them you’ll end up with a whole lot of discs. Booting your installations from the network, using a PXE boot server, makes life a lot easier and isn’t very hard to setup. In this post I’ll explain how to setup such a PXE boot server that is able to provide multiple Linux distribution installations for deployment over the network.
Setup an FTP-server with quotas on RHEL or CentOS 6 or 7 with proftpd
Using FTP actually should be avoided whenever that’s possible but sometimes it’s just the most handy and convenient way of transferring files. In most cases, your FTP-users will be able to upload files to the FTP-server. To avoid that some users would fill up the complete machine, you can use quotas. In this post, I’ll describe how to setup a basic proftpd FTP-server with quotas on RHEL or CentOS 6 and 7.
Move a guest from VMWare ESX to oVirt or RHEV
When working in an environment where you have both a VMWare hypervisor and an oVirt or RHEV hypservisor or you want to migrate away from VMWare ESX to oVirt or RHEV, you will need a way to move or copy your current virtual machines from one to another. Unfortunately this can’t be done without downtime but at least it can be done. In this post I’ll try to explain how to successfully move a VM running on ESX or vCenter to an oVirt or Red Hat Enterprise Virtualization host.
Create a new virtual machine in oVirt with Python using the API
Recently, I started to work or play, it’s a matter of definition, a little more with oVirt. oVirt is less known than VMWare but it’s the upstream project for Red Hat’s Enterprise Virtualization (RHEV) and based on libvirt. In an earlier post, I explained how to create VM’s on VMWare vSphere environments using Python and the VMWare API. In this post, I’ll explain how to acomplish the same using the oVirt API. It turned out to be easier than I expected.
Monitor oVirt or libvirt with SNMP and Zabbix
Somehow, I expected to have little to no work when I wanted to monitor an oVirt host over SNMP. One would expect this since oVirt is the upstream project for Red Hat’s Enterprise Virtualization (RHEV) which seems to be quite strong in the market. While it isn’t that hard to get information about using SNMP for oVirt or libvirt the outcome can be disappointing. There is some documentation about it but here you can find a more hands-on explanation.
Configure two network cards in a different subnet on RHEL 6, RHEL 7, CentOS 6 and CentOS 7
When configuring a Linux host running either Red Hat Linux 6, Red Hat Linux 7, CentOS 6 or CentOS7 with two network interface cards (NIC) that each have an IP address in a different network or subnet, you could end up in a situation where one of the IP addresses isn’t reachable outside it’s own network. Both IP’s will be responding to a ping from another host in the same network as those IP addresses but only one is responding to ping from another network. On most other distributions, like Debian, this issue, which is caused by asymmetric routing, doesn’t seem to exist.
Compile the Huawei ES3000 PCIe SSD driver for CentOS 7 or RHEL7
The Huawei ES3000 is an SSD accelerator card connected to the PCIe bus which delivers exceptional performance. Today, I found out that Huawei doesn’t provide any ready made drivers to use a Huawei ES3000 PCIe SSD on a system running a Linux kernel > 3.x. This means that it’s not possible to use it on RHEL 7 or CentOS 7 or any other modern Linux distribution that uses a kernel newer than version 2.6.32.63. Fortunately it’s not difficult to compile the driver, install it and start to use the SSD accelerator with a newer kernel.
Expand or grow a file system on a Linux VMWare VM without downtime
When your VM’s file systems are running out of space and you want to provide more space to your VM and you can’t afford any downtime, there are basically two options. Either you delete some files on the file system or you expand your current file system. Expanding your current file system can be accomplished by growing an existing virtual disk or adding a new virtual disk. Besides cleaning up, both other solutions work fine and I’ll try to explain how to get both of them active without rebooting the system or any downtime.
Create a new virtual machine in Vsphere with Python, Pysphere and the VMWare API
The VMWare API is very extensive and allows you to do almost all operations that are possible with VMWare using API calls. In order to be able to easily create and deploy new virtual machines, it can be a good idea to standardize and create VM’s using a (Python) script that calls the API. In this post, I will give some examples on how to easily create a new VM using Pysphere and the VMWare API.
Clone a z/VM Linux user/guest instance from another Linux guest
Cloning a virtual machine or user as it is called in z/VM terms from within another guest/user running Linux can be used in a lot of different scenario’s. Especially when the people managing the z/VM platform and virtual machines are less experienced with z/VM, it could be good to let them create a clone without the need to access a 3270 terminal. This scenario can also be used to let users do some self service and provide them with new instances without intervention.
Install and use the openlava job scheduler and openlava web GUI on CentOS
Scheduling on Linux mostly happens with cron or any of it’s variations. Although cron is very powerful, it lacks a few features to use it in a flexible way and especially when you want to create dependencies or “communicate” with jobs running on other hosts, it has it’s shortcomings. Cron wasn’t really designed with those features in mind. Fortunately there are a few nice schedulers out there which can be used to overcome those limitations. A few of them are SOS Jobscheduler, GNUBatch and openlava. Openlava is a limited open source fork of LSF which is now owned by IBM. Openlava doesn’t come with a GUI but there is another project, Openlava web which enables control over openlava via a web interface.
Write to and manage syslog messages with logger and rsyslog
Syslog is the target where you want all log message to go on all systems that you manage. Almost all Linux distributions use a syslog implementation to gather messages. Recently, rsyslog became the most used syslog-implementation for Linux. Messages can be saved locally or sent to a remote syslog server. When creating your own applications or tools or when you want to log messages coming from processes that don’t support writing to syslog directly, you can use Logger.
Use DRBD in a cluster with Corosync and Pacemaker on CentOS 7
When configuring a cluster, you want tot keep managing the server as simple as possible. Theoretically, the results given by any node in the cluster should be equal as you want the cluster to be transparent to the end-user. Part of doing this, is having the same data available on every node of the cluster when it’s active. One way to do this, is using a central file-share, for example over NFS but this also has disadvantages. Another way is to have a distributed file system that stays on the nodes itself. DRBD is one of them. This post explains how to integrate DRBD in a cluster with Corosync and Pacemaker.
Forward a TCP port to another IP or port using NAT with Iptables
Besides using NAT for accessing the internet with multiple machines using a single IP address, there are many other uses of NAT. One of them is to forward all traffic that is sent to a certain TCP port to another host. In practice, this technique can be used to test a service on a new host without adjusting anything on the client. The users or the clients do not need to be pointed to a new machine in order to test it. When the test would be unsuccessful, removing the NAT-rule is all it takes to switch back.
z/OS command collection
In the not so far past, I spent a lot of my time working with and configuring z/OS or MVS mainframes. Over time, I managed to collect a serious collection of useful MVS-commands. Most of these commands can just be found in the forests of IBM documentation but the keyword in my previous sentence is “useful”. I found it, even as a person who was working for years in z/OS environments always difficult to get the right command for a certain action. The lack of examples and over-theoretical explanations made it, at least for me, not very accessible.
Find and recover space used by deleted files, shown by df but not by du
When you’re running low on space on a file system, that can cause various unexpected behavior of the system, depending on which file system is filling up. For me, when that happens, I usually first issue a disk free (df) to see which is the file system that is almost full. Once I know which file system, I go and search which files take up the most space in that file system and take action. Sometimes, df show that a file system is almost full while, when summing up all the space by all files doesn’t even come near that value.
Install and use Debian Wheezy as Xen virtualization host
Earlier, I explained how to setup CentOS or RHEL as a KVM virtualization host. You can find that explanation here. It also contains some basic terminology about virtualization which is also applicable for Xen. When talking about KVM, somehow, I immediately associate it with the Red Hat family just as when you talk about Xen, I associate it to Debian derivatives. So for this post, I’ll use Debian to install a host that will run Xen-VM’s by using paravirtualization.
Start with a simple 2-node OpenStack setup with KVM
OpenStack is something that gets more and more in the picture and even if you’re only a little interested in the latest technologies, you must have heard from OpenStack here or there. But what is it exactly and more important, how does it work practically. The best way to figure that out is just to get going with it and try to install it and play around. Here you can find a brief explanation and a tutorial or waltrough to deploy a small OpenStack environment on top of CentOS 7 or RHEL 7.
Read and write a CMS minidisk on a z/VM system from a user/guest running Linux
When you’re managing a z/VM host running multiple Linux images, it can be interesting to have access to the data which resides on a CMS owned minidisk. Such type of minidisk is probably used to control the z/VM related configuration of the guest itself in some way. Also, when scripting, the explained technique can be used to read or write data from and to one of the minidisks. One example could be to change the PROFILE.EXEC from a user from within the user itself.
Terse, unterse and transfer datasets between z/OS and other platforms via FTP
Tersing files can be compared to tarring, zipping, rarring files on the x86 platform. It allows you to store a file or multiple files (members) in an archive. The archive is easily transferable and when the data is unpacked, it is guaranteed to be the same as the original source. Especially when transferring PDS’es and variable blocked (VB, VBS) datasets, this is important. Transferring normal datasets over FTP through other platforms from z/OS can be challenging an this article should provide some help.
Execute queries on a Microsoft SQL server from the Linux CLI with ODBC and Kerberos authentication
A while ago, the Windows-world and the Linux-world were not the best friends in communicating with each other. Especially not when it came to proprietary stuff like Microsoft SQL server. in contrast to everybody’s expectations, somewhere end 2011, beginning 2012, Microsoft released an ODBC driver for SQL server for Linux. This driver allows executing queries from a Linux machine to a Microsoft SQL Server database. The driver can be used in combination with Kerberos tickets and AD authentication to execute queries.
Use inotify-tools on CentOS 7 or RHEL 7 to watch files and directories for events
Today, I discovered that the package inotify-tools is nowhere to be found in standard CentOS7 or RHEL7 repositories. Alternatives like incron seem to be absent as well. The inotify-tools can be used to watch a directory or file for activity and take an action when a file is changed, added, edited or simply read. You can find a workaround (or call it solution) for the absence of the inotify-tools in the repositories here.
Mount Windows (CIFS) shares on Linux with credentials in a secure way
In almost all cases, when mounting a CIFS-share on a Linux host, you will need to supply some credentials. Either you could enter the credentials by hand every time you need the share or add the credentials to /etc/fstab to automatically mount the share. Entering the password manually is secure but not comfortable, leaving the password in /etc/fstab is comfortable but not secure since the file /etc/fstab is world readable.
Spacewalk 2.2 installation on CentOS 7
Spacewalk is the upstream-project for Redhat Satellite. It’s a tool which is mainly used to list, deploy and manage packages and updates to Fedora, CentOS, SLE and even Debian installations. Currently, there is no official documentation on how to run Spacewalk on a el7 based installation like CentOS 7. The installation is not a straightforward as one might think but it is possible.
Install and use CentOS 7 or RHEL 7 as KVM virtualization host
When thinking about virtualization, everybody immediately thinks about VMWare. And it must be said, the product they offer is very decent but also comes with a “decent” price. As an alternative, it’s worth looking into KVM for your virtualization. As with the VMWare product range, KVM offers full virtualization and it can compete with VMWare regarding stability and performance.
Split horizon DNS master/slave with Bind
Split horizon is the ability for a DNS-server to give a different answer to a query based on the source of the query. A common use-case is when using the same DNS-server for internal and external queries. When your DNS is publicly available, you really don’t want to enable recursion to the outside world but internally it could be handy. Besides security there are also examples where resolving a certain name needs to return an internal IP while externally that IP is useless and it’s better to return something else.
Basic master and slave DNS setup with Bind
DNS or Domain Name System is one of the most important building blocks of the modern IT and internet. DNS allows you to use meaningful names instead of IP addresses. Especially since IPv6 is getting more popular, DNS remains a very important part of your network. This article will describe how to set up a basic master DNS-server and a slave which will replicate the data from the master.
Building a high-available failover cluster with Pacemaker, Corosync & PCS
When running mission-critical services, you don’t want to depend on a single (virtual) machine to provide those services. Even when your systems would never crash or hang, from time to time you will need to do some maintenance and restart some services or even the whole machine. Fortunately, clusters were designed to overcome these problems and give the ability to reach a near 100% uptime for your services.
Install MATE or XFCE on CentOS 7
Which desktop environment you prefer is very personal. Each of them has its advantages and, unfortunately, also its disadvantages.
Recently, I started to like MATE since it’s lightweight and customizable in a way I personally like. Before, I was a fan of XFCE for similar reasons but somehow I got a little tired and irritated of it’s shortcomings.
This post covers how to install any of those on top of a minimal install since this means it can be installed on top of almost every type of installation in regards to package selection and dependencies.
Use iptables instead of firewalld in RHEL 7 or CentOS 7
If you, like me, can’t get used to the “new” firewalld in RHEL/CentOS 7 or you have some automation scripts that expect iptables, then I’ve got good news for you :) It’s rather easy to disable firewalld and go back to a “normal” iptables configuration as it used to be.
There are no special tricks involved and/or custom actions that would break your system or put it in a way that you have to be affraid of updating.
Remote graphical Linux-applications on Linux and Windows
In order to use graphical applications on a Linux machine, it doesn’t need to run the X-server itself. This means that it is possible to use graphical tools on a machine that doesn’t even have a graphical interface installed or even a machine without a video card and keyboard/mouse connected.
Migrate RHEL7 to CentOS7
A migration from RHEL7 to CentOS7 could be something that is needed in certain cases. While re-installing the OS and tranferring your files and settings is not undoable, it creates a lot of effort and possible chance for downtime. Therefor it’s much more handy when an in-place migration between the two can be done. CentOS uses the same package-source as RHEL and tries to be as close as it can be to Red Hat with their distribution. It’s basically RHEL without logo’s, support and licensing.
Install a newer kernel in Debian 7.5 (Wheezy) or CentOS 6.5
When using the latest version of Debian Wheezy or CentOS 6.5, even with all updates installed, by default, you can’t get a very recent kernel via the standard repositories in your package manager. While the idea of both distributions is to remain stable and rather conservative, there are several benefits with installing a newer kernel and in some cases it’s the only option to run one of these distributions. The risk and impact on stability is small and the process is rather simple.
SSD optimize your Linux
SSD drives became a common storage-device for most computer enthusiasts and while they have a lot of advantages in comparison with the “traditional” hard disk, it’s main disadvantage is that the write-operations are theoretically limited. This process is called wearing. In order to prevent your SSD from wearing out, to maximize it’s lifespan and to improve it’s performance, you can performthe following steps: