Search This Blog

Powered by Blogger.

Pages

Browsing "Older Posts"

How to show sent mail in Thunderbird threaded conversation

By TY → Sunday, October 11, 2015
To see our sent mail in threaded conversation view in Thunderbird, we have to first enable unified view for folders.

After the unified inbox appear, right click on it and select "properties"
Click "Choose" to select the sent folder from the mail accounts that you want to have the sent mail appear in threaded view.

Reference:
http://superuser.com/questions/67488/can-mozilla-thunderbird-show-sent-replies-in-threaded-view

Gmail to allow less secure app to connect

By TY →


Some of my old java application that used to be able to send out email via Gmail fails. This seems to be due to a security enhancement sometime back in Gmail.

We now need to explicitly allow less secure applications to connect to Gmail. In order to do that, we will have to


  1. Go to
    https://www.google.com/settings/security/lesssecureapps
  2. Check "Allow access for less secure apps"
Note that, this feature is not available for google account with 2-steps verifications enabled.

For more information:
https://support.google.com/accounts/answer/6010255?hl=en

Unable to build in intellij idea when using lombok

By TY →
When using lombok with intellij, there is a great lombok plugin that enable Intellij to pick up the getter setter methods within the editor. However, when trying to build within Intellij, the build will fail.

To solve this, we only need to configure Intellij to process the annotations.
Go to Settings and type in "Enable annotation processing" in the search field and click "Annotation Processors" in the result.


Then just check "Enable annotation processing"

Reference : 
http://stackoverflow.com/questions/9424364/cant-compile-project-when-im-using-lombok-under-intellij-idea

Mac OS profile not loading in terminal

By TY →


This issue happened for me after installing google cloud engine for kubernetes.
After some search, This have helped me resolved it. The profile was not loaded in the terminal because .bash_profile exist.


  1. Move the following into the end of your "~/.profile"
    # The next line updates PATH for the Google Cloud SDK.
    source '/opt/App/google-cloud-sdk/path.bash.inc'
    
    # The next line enables bash completion for gcloud.
    source '/opt/App/google-cloud-sdk/completion.bash.inc'
    
  2. Rename "~/.bash_profile" as "~/.bash_profile_old"

Reference :
http://stackoverflow.com/questions/11498070/bash-profile-not-loading

Docker client and server don't have same version

By TY →


This can happen if you have updated docker, but the service has not been restarted. You will then try to connect to the docker daemon with the updated client, while the daemon (that was already running before the update) is still running the older version.
To fix this, restart the service:
sysV init:
service docker restart
systemd:
systemctl daemon-reload
systemctl restart docker

Reference:
http://stackoverflow.com/questions/24586573/docker-error-client-and-server-dont-have-same-version

Kubernetes, Vagrant on Mac OSX

By TY → Monday, June 8, 2015


I was having a bit of trouble building kubernetes based on Vagrant on Mac OSX.

Seems like the issue is mainly due to wget complains about HTTPS certificates. So tweaked the scripts a bit to fix the error to successfully load the Kubernetes example.

export KUBERNETES_PROVIDER=vagrant 
curl -sS https://raw.githubusercontent.com/tykoh/kubernetes/master/k8s.sh | bash

Use the above instead of the example from Kubernetes' documents.
export KUBERNETES_PROVIDER=vagrant
curl -sS https://get.k8s.io | bash

You can check out the tweaked to the script at GitHub. Basically, just add a flag to wget command so as not to check cert.

Docker Galera Image for Mysql clustering Active-Active with backup solutions

By TY →


After spending some time on Mysql backup script, I realized that the backup for Mysql only comes with Enterprise Edition of Mysql.

Since I have started working on containers, I looked into building Docker images for a possible solutions for the typical production configuration:
1. High availability
2. Active-Active
3. Backup (Weekly full, daily incremental)

I came across Galera which provides 1 and 2. Also, during my search, I came across the open source backup solution for MySql from percona which will provide for item 3 on the list above.

So based on the above, I have come up with a docker build file to satisfy 1, 2 and 3. You can find the project on GitHub.

Dockerfile:

# from http://galeracluster.com/2015/05/getting-started-galera-with-docker-part-1/

FROM ubuntu:14.04
MAINTAINER TYKOH 
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 BC19DDBA
RUN add-apt-repository 'deb http://releases.galeracluster.com/ubuntu trusty main'
RUN apt-get update
RUN apt-get install -y galera-3 galera-arbitrator-3 mysql-wsrep-5.6 rsync lsof
RUN \
    echo "deb http://repo.percona.com/apt trusty main testing" > /etc/apt/sources.list.d/percona.list && \
    echo "deb-src http://repo.percona.com/apt trusty main testing" >> /etc/apt/sources.list.d/percona.list && \
    apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A && \
    apt-get update && apt-get install -y percona-xtrabackup
COPY my.cnf /etc/mysql/my.cnf
ENTRYPOINT ["mysqld"]


Building the docker image

docker build --tag=galera .

Local cluster setup

Starting the first node:

docker run \
-p 3306:3306 \
--detach=true \
--name node1 \
-h node1 \
galera \
--wsrep-cluster-name=default-cluster \
--wsrep-cluster-address=gcomm://

Starting node 2:

docker run \
--detach=true \
--name node2 \
-h node2 \
--link node1:node1 \
galera \
--wsrep-cluster-name=default-cluster \
--wsrep-cluster-address=gcomm://node1

Starting node 3

docker run \
--detach=true \
--name node3 \
-h node3 \
--link node1:node1 \
galera \
--wsrep-cluster-name=default-cluster \
--wsrep-cluster-address=gcomm://node1

Multi-node cluster

  • Mysql port at 3306
  • Galera cluster port at 4567
  • Galera increamental state transfer (IST) port at 4568
  • Galera state snapshot transfer (SST) port at 4444
We got to map the ports to different local port as we are all running in the same host machine. If the containers are running on different host machine, there is no need to map to different local port. Just do a 1:1 mapping of the actual ports.

Get ip address of machine

export IP_NOW=`ifconfig | awk '/inet /{print substr($2,1)}' | tail -n 1`

Starting first node

docker run -d \
-p 33060:3306 \
-p 45670:45670 \
-p 44440:44440 \
-p 45680:45680 \
--name nodea \
galera \
--wsrep-cluster-address=gcomm:// \
--wsrep-node-address=192.168.99.100:45670 \
--wsrep-sst-receive-address=192.168.99.100:44440 \
--wsrep-provider-options="ist.recv_addr=192.168.99.100:45680"

Start node b

docker run -d \
-p 33061:3306 \
-p 45671:45671 \
-p 44441:44441 \
-p 45681:45681 \
--name nodeb \
galera \
--wsrep-cluster-address=gcomm://192.168.99.100:45670 \
--wsrep-node-address=192.168.99.100:45671 \
--wsrep-sst-receive-address=192.168.99.100:44441 \
--wsrep-provider-options="ist.recv_addr=192.168.99.100:45681"

Start node c

docker run -d \
-p 33062:3306 \
-p 45672:45672 \
-p 44442:44442 \
-p 45682:45682 \
--name nodec \
galera \
--wsrep-cluster-address=gcomm://192.168.99.100:45670 \
--wsrep-node-address=192.168.99.100:45672 \
--wsrep-sst-receive-address=192.168.99.100:44442 \
--wsrep-provider-options="ist.recv_addr=192.168.99.100:45682"

Post command to set up database

docker exec -t nodea mysql -e "create user 'username'@'localhost' identified by 'user_password';"
docker exec -t nodea mysql -e "create user 'username'@'192.168.0.0/255.255.0.0' identified by 'user_password';"
docker exec -t nodea mysql -e "grant all on *.* to 'username'@'192.168.0.0/255.255.0.0';"
docker exec -t nodea mysql -e "grant all on *.* to 'username'@'localhost';"

Start container to do backup

docker run \
--detach=true \
--name nodeBackup \
-h nodeBackup \
--link node1:node1 \
-v $(pwd):/data \
galera \
--wsrep-cluster-name=default-cluster \
--wsrep-cluster-address=gcomm://node1

Using innobackupex

docker exec -it nodeBackup /bin/bash
mkdir -p /data/backup
innobackupex --user=username --password=user_password --port=3306 --host=node1 /data/backup

Check cluster

docker exec -ti node1 mysql -e 'show status like "wsrep_cluster_size"'