Archive for July, 2008

Comparing Bash with… Windows command line shell…

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

You may already be known that Microsoft claims that Windows PowerShell (comes with its Vista by default) script language helps IT professionals achieve greater control and productivity and to accelerate the automation during system administration process. As a non-Windows but *nix systems administrator/engineer I was always interested if it is possible to access those functions and objects we can easily get in Bash (of course we are talking about each operation system’s specific procedures and objects).

And these days I came across a good article “Shell Games” (by Marcus Nasarek) telling about above mentioned matters…

Both Bash and the Windows Vista PowerShell include commands for navigating directories, managing files, and launching other programs. System administration is an important duty for the shell, and Bash and PowerShell are equipped to help manage systems from the command prompt. Whereas Bash typically relies on a combination of newer tools and classic Unix utilities, the PowerShell has its own set of command-line programs. Windows refers to PowerShell commands as cmdlets. The PowerShell cmdlet called Get-Process is a counterpart to ps, and the cmdlet Get-Content corresponds to less. PowerShell differs significantly from previous Windows command shells. In this article, I look at how Windows Vista PowerShell compares with Bash. Read more >>

More useful links:

1. Microsoft PowerShell official page
2. Bash Reference Manual
3. GNU Bash for Windows

OpenLDAP + Samba Domain Controller on Debian or Ubuntu

samba logoHistorically domain controllers (DCs) were Windows servers responding to security authentication requests (logging in, etc.) within the Windows Server domain. Today Samba project goes beyond emulating Windows shares and can be used as Primary Domain Controller in Windows network.

To help people who are under installing/configuring Samba as a DC in their network I published here several links which helped me with this task. First of all, be ready for long time configuring as compared with Windows Active Directory configuration it takes much more time to do the same task with Samba… But practically vendor independent solutions usually worth time spent on compiling, installing, configuration and maintenance.

Why Debian/Ubuntu? Looking through Google’s findings regarding DC set up on these distributions, I noticed some kind of lack of the quality resources lying at the top.

1. The first place one should visit in order to start with above mentioned task is Samba official documentation. Probably not everything that is covered by it would be used, but this is the only place you can find some special aspects of installation and configuration their software.

2. Ricky Jone’s article on howtoforge.com is an excellent guide on how to get the task done on Ubuntu 7.10.

3. Excellent article “SAMBA (Domaincontroller) Server For Small Workgroups With Ubuntu 6.10” written by Till Brehm is applicable also for later Ubuntu versions.

4. Steve Lacey wrote interesting and informative article about Samba on Debian as primary DC on his blog.

5. A certain mawi wrote very informative manual:

Read this document on Scribd: Samba And Ldap On Debian

FAQ: How to install and configure MySQL cluster?

Question: Can you give me more information on how to set up MySQL cluster?

Answer: Sure, below are the links to extremely informative Internet resources providing detailed guides on why and how to deploy MySQL cluster.

By the way a cluster in IT field is a group of linked computers, working together so they form a single computing system. The components of a cluster are usually connected to each other via fast local area networks. Clusters are usually deployed to improve performance and/or availability over that provided by a single computer, while typically being much more cost-effective than single computers of comparable speed or availability.

1. http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster.html

MySQL Cluster is a high-availability, high-redundancy version of MySQL adapted for the distributed computing environment. It uses the NDBCLUSTER storage engine to enable running several MySQL servers in a cluster. This storage engine is available in MySQL 5.0 binary releases and in RPMs compatible with most modern Linux distributions.

2. Mysql Cluster: The definitive HOWTO

3. How To Set Up A Load-Balanced MySQL Cluster

This tutorial shows how to configure a MySQL 5 cluster with three nodes: two storage nodes and one management node. This cluster is load-balanced by a high-availability load balancer that in fact has two nodes that use the Ultra Monkey package which provides heartbeat (for checking if the other node is still alive) and ldirectord (to split up the requests to the nodes of the MySQL cluster).

4. MySQL Cluster Server Setup

MySQL Cluser Server is a fault-tolerant, redundant, scalable database architecture built on the open-source MySQL application, and capable of delivering 99.999% reliability. In this paper we describe the process we used to setup, configure, and test a three-node mySQL cluster server in a test environment.

Quick copy/paste MySQL Replication Manual

This quick manual tells how to set up database replication in MySQL. Basically it was written for 5.* MySQL versions but is also applicable for 3.23/4.0 ones (btw they are still in use, believe me).

As you might already know, replication allows you to create a copy of certain MySQL database from a master server on another server (slave). What is the most important, all updates made to that database on master server will be replicated to the database on the slave server immediately, so that both databases are synchronized almost in real time mode (if you need completely real-time synchronization/mirroring, the only solution is to deploy MySQL cluster).

One of the main issues is that replication features coming out-of-the-box with Open Source MySQL software don’t provide full back/forward compatibility. This means that you can easily replicate data from master and slave of the same MySQL versions only e.g. 5.0. But if you like to replicate database from 5.0 master to 4.0 slave (or from 3.23 master to 5.0 slave), it is not possible in most cases.

From the beginning we have two Linux boxes with MySQL installed (5.0.27 version in my example), server has database reptest we need to replicate to slave.

A. Configure Master:

Configure MySQL to accept incoming connections from another hosts in the network. In order to do it, comment the following lines in /etc/my.cnf (exact location depends on Linux distribution you use) as follows:

#skip-networking
#bind-address=127.0.0.1

and restart MySQL by “/etc/init.d/mysql restart” or “mysqladmin reload” command. Make sure that slave can access master’s MySQL via network (e.g. execute on slave “telnet <server_ip> 3306“).

The next step is to configure master to log all database changes into binary log that will be used by slave for replicating, add the following lines to /etc/my.cnf in [mysqld] section:

log_bin = mysql-bin
binlog-do-db=reptest
server-id=1

Then restart MySQL and log on to its shell with root rights:

/etc/init.d/mysql restart
mysql -u root -p
Enter password:

Type in MySQL shell the following commands:

GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_password';
FLUSH PRIVILEGES;

Note: If you use 4.0 MySQL or older, you need to replace REPLICATION SLAVE in above line to FILE, so the lines will look like:

GRANT FILE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_password';
FLUSH PRIVILEGES;

The next commands are:

USE reptest;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;

The last command should provide the following output we will use later on slave server:

mysql> SHOW MASTER STATUS;
+---------------+----------+-----------------+------------------+
| File          | Position | Binlog_do_db    | Binlog_ignore_db |
+---------------+----------+-----------------+------------------+
| mysql-bin.001 |   73     | reptest         |                  |
+---------------+----------+-----------------+------------------+
1 row in set (0.00 sec)

Now quit from MySQL shell as we need to prepare current dump of reptest database: quit.

Now, run from shell “mysqldump -u root -p --opt reptest > reptest.sql” and transfer reptest.sql file to slave server.

2. Configure Slave:

Create reptest database:

mysqladmin create reptest

and apply previously created/transfered dump to it via command:

mysql -u root -p reptest < /path/to/reptest.sql

Now edit /etc/my.cnf on slave and add the following lines to [mysqld] section:

server-id=2
master-host=192.168.0.1
master-user=slave_user
master-password=slave_password
master-connect-retry=60
replicate-do-db=reptest

where 192.168.0.1 is IP address of the server and server-id is unique ID assigned to slave Linux box.

Now restart MySQL with /etc/init.d/mysql restart and log on MySQL shell:

mysql -u root -p reptest
Enter password:

The next step is to apply changes saved in binary log on server:

SLAVE STOP;
CHANGE MASTER TO MASTER_HOST='192.168.0.1', MASTER_USER='slave_user', MASTER_PASSWORD='slave_password', MASTER_LOG_FILE='mysql-bin.001', MASTER_LOG_POS=73;
SLAVE START;

Now whenever reptest is updated on the master, all changes will be replicated to reptest on the slave.

Here are useful links you can use to get more information about MySQL replication and how to configure it:

http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html
http://www.howtoforge.com/mysql_database_replication
http://www.onlamp.com/pub/a/onlamp/2005/06/16/MySQLian.html




Information Improvisation: Operating system is the backbone for every organization. Having professionals with CISSP certification in organization ensures the life running through its networks. Organizations manage tremendous amounts of traffic due to the use of pc phone and people with 646-058 certifications are ideal for this job. They can also manage online networks which can be hosted on lunarpages, which also provides free email hosting. With the company's logo design every page and a well crafted web template the site can be given a graceful look.

 

Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | LinuxHaxor.net | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››