Setting up mySQL replication

As a complete solutions provider for our clients we have extensive experience hosting the websites we build for these clients. Ranging from shared webservers, over cloud and dedicated servers, to multi server setups to provide the maximum performance and reliability. While preparing the setup for a new client I thought I’d start a series on how to setup some of the more complex systems. Starting today with mySQL replication.

We have two servers, both should end up containing the same, in sync database. The first one will be hcs01.kunstmaan.be and will be the master database, hcs02.kunstmaan.be will be the slave database.

Let’s start by installing the mySQL database server. Open a terminal to both servers and become root (I consider these commands to be common knowledge so i won’t go into detail here) and run:

apt-get install mysql-server

While replicating, these two servers need to stay in contact to each other. In cases such as these you don’t want to rely on a DNS server, so you can either use an IP address or add the hostnames to your /etc/hosts file. Since I cannot remember IP address, hostnames it is. So add the two servers to the /etc/hosts file on both servers. My lines would look like:

78.46.128.114  hcs01
78.46.128.115  hcs02

On Ubuntu mySQL is configured to only listen on 127.0.0.1. If our slave database wants to connect to the master, we need to change this in the master config. Open /etc/mysql/my.cnf and find the bind-address statement. Comment it out so it looks like:

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
#

In this same file we will activate the replication options. The server-id statement is an unique number assigned to each server. It defaults to 0 and it will not allow replication it it is. So the we change the master server-id to 1. The log_bin statement lists the file the server will log into. This log is used by the slave to replicate it’s content. We will expire this log in 10 days or if it is larger than 100MB. It should look like:

server-id               = 1
log_bin                 = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M

Restart the mySQL server to load the changes.

service mysql restart

Last step on the master, we will need a replication user. Connect to your mySQL server and create this user and add the REPLICATION SLAVE permissions to it.

mysql> CREATE USER 'repl'@'%' IDENTIFIED BY 'slavepass';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
mysql> FLUSH PRIVILEGES;

Run the following command to show the status:

mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |      627 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

Up next, the slave.

Edit the /etc/my.cnf and set the server-id statement. We are using 2, different from 0 and the one (1) we used for the master server. The section should look like:

server-id=2
master-connect-retry=60

Restart the mySQL server to load the changes.

service mysql restart

Now, connect to the mySQL server and let link it to our master server. The values are the user we created before, and the info shown when we ran “show master status;

mysql> CHANGE MASTER TO MASTER_HOST='hcs01', MASTER_USER='repl', MASTER_PASSWORD='slavepassword', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=627;
mysql> START SLAVE;
mysql> SLAVE STATUS \G

You will see something like:

************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: hcs01
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 627
               Relay_Log_File: hcs02-relay-bin.000002
                Relay_Log_Pos: 772
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 627
              Relay_Log_Space: 927
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)

Your setup is working if Slave_IO_Running and Slave_SQL_Running are both Yes. If you create a new database, table or row in the master, it will appear within seconds on the slave.

We’re always looking to improve our setup, so if you implemented this on your servers and have valuable insights to share, please do so in the comments!

 

BootstrapCK skin

Every time you edit a page in a content management system, you are greeted in some form or another by a rich text editor. There are a lot of different editors available but at Kunstmaan we are fans of CKEditor, it’s almost perfect, it only has one mayor flaw. It’s ugly and almost certainly does not match the look and feel of your administration interface.

This would not stand for our projects, so we created a skin based on the excellent Twitter Bootstrap project, and open source would not be open source if we didn’t share this theme with the community.

So without further ado, we present to you the BootstrapCK skin for CKEditor. Created by our resident frontend wrangler: Indri

BootstrapCK Skin

Demo and source files are available on Github: http://kunstmaan.github.com/BootstrapCK-Skin/ 

 

#Facebook Timeline

At the end of September, Facebook announced Timeline and made it available to developers building Facebook apps. Kunstmaan of course has this kind of developers in its team, so we all got the chance to see its potential.

Now, more than 2 months later, Facebook is finally making its Timeline more widely available. So don’t be surprised if your Facebook design suddenly changes. A LOT.

What changes?

Status updates: Almost the same, except now you can also add ‘life events’, like when you have a new job, a new child, bought a home, lost weight, got a tattoo, …

Older posts: Older posts have always been available on Facebook. But if you wanted to check your very first post, you had to scroll down a long, long time (if you post as much as I do). Now you can easily click on the year and month of the post you were looking for and that post will become visible in no time.

Privacy settings: Of course they change too. And probably back to standard settings. So definitely don’t forget to check these! A new tool that can help you with this is the Activity Log. Here you can see, hide and delete all your posts and apps. And choose who can see them and who don’t.

Oh yeah and that cover photo above. A new way to personalize your profile page. And a new way to be creative. Like these people: http://www.socialmediaexaminer.com/16-creative-ways-to-create-your-facebook-timeline-cover-photo/

 

HTML5 Video, een overzicht.

HTML5 introduceert verschillende nieuwe tools voor het bouwen van dynamische websites en applicaties. Eén hiervan is het <video> element. In theorie maakt dit het invoegen van video’s in websites net zo simpel als het invoegen van afbeeldingen met het <img> element.

In de praktijk is HTML5 video nog volop in ontwikkeling. Belangrijke opties ontbreken nog, niet alle browsers herkennen <video> en de browsers die dat wel doen ondersteunen verschillende formaten. HTML5 video werkt echter uitstekend op smartphones en tablets (iOS en Android). Al met al kan het, met enig denkwerk, vandaag al gebruikt worden in productie. Een volledig overzicht is terug te vinden op de Fronteers website.

HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Graphics, 3D & Effects, Multimedia, Performance & Integration, Semantics, and Offline & Storage

via HTML5 Video | Een overzicht · Fronteers.

 

Ambassadeurs

Zo krijg je ambassadeurs voor je merk. Mooi staaltje van LinkedIn.

Dear Geert,
I want to personally thank you because you were one of LinkedIn’s first million members (member number 487693 in fact!). In any technology adoption lifecycle, there are the early adopters, those who help lead the way. That was you.
We hit a big milestone at LinkedIn this week when our 100 millionth member joined the site.
When we founded LinkedIn, our vision was to help the world’s professionals be more successful and productive. Today, with your help, LinkedIn is changing the lives of millions of members by helping them connect with others, find jobs, get insights, start a business, and much more.
We are grateful for your support and look forward to helping you accomplish much more in the years to come. I hope that you are having a great year.
Sincerely,
Reid Hoffman
Co-founder and Chairman
LinkedIn

 

Is er nog verschil tussen strategisch management en brand management?

Competitiestrategie bij Porter in 1980 keek vooral van buitenuit naar de organisatie. Concurrentie kon van overal komen (uit de sector, van klanten en leveranciers, van vervangproducten, of nieuwe producten die het jouwe misschien zelfs overbodig maken). Succesvolle bedrijven waren dan bedrijven die zich goed konden verdedigen tegen deze aanvallers (door hoge intredebarrières, onvervangbare producten, een groot marktaandeel, weinig onderhandelingsmacht bij leveranciers en klanten).

Competitieve dreiging zal nooit genegeerd mogen worden, zoals ook de banken zullen getuigen wanneer Google of sterke telco’s een groot deel van hun activiteiten zullen overgenomen hebben.

Maar.
Al in ’99 toonde onderzoek dat de bedrijven die in de periode ’80-’99 meest succes (in ROI) hadden gekend, helemaal niet overeenkwamen met wat je zou verwachten vanuit de externe filosofie van Porter. Wat deze bedrijven wèl onderscheidde, waren interne kenmerken: organisatiecultuur en betrokkenheid; gedeelde waarden, een consistente visie, normen, een collectieve identiteit.

In ‘Built to last’ werd gevonden dat bedrijven succesvol worden door:
- in stilte werken aan een krachtige organisatie
- focus op de kern, en van daaruit meegaan met evoluties
- nastreven van BHAGs (big hairy audacious goals), quasi onbereikbare maar duidelijke en inspirerende doelen
- trial and error
- management vanuit interne doorgroei
Stuk voor stuk interne elementen.

Tegenwoordig ligt de nadruk in strategisch management dan ook veel meer op interne krachten dan op externe omgevingsanalyse. Waar een bedrijf voor staat (missie, visie, onderscheidende kerncompetenties), de mate waarin dat geconcretiseerd en geëxpliciteerd wordt, en de investering die gedaan wordt in het tot leven brengen daarvan bij iedere medewerker in de onderneming zijn essentieel.

Na 1.293 lezingen over authenticiteit weten we bovendien dat het weinig zin heeft om een merk te bouwen ‘naast’ de interne realiteit. Een sterk merkbeleid houdt voortdurend rekening met een afstemming tussen interne realiteit en extern beeld, en dus met dezelfde interne aspecten die zo belangrijk zijn voor het strategisch management.

…is er dus nog verschil tussen strategisch management en brand management?