Mobil Mewah

Salah satu sumber Inspirasi.

Monday, 23 July 2018

keepalived issue with iptables

When talking about High Availability services, we can use keepalived to do a automatic failover between 2 host. Keepalived is working like a charm by using a virtual ip. 1 Master elected for normal operation, and others as backup. When master have issue, backup will take over the services. Issue arise with configuration, where there is iptables entry to drop any vrrp traffic type. This was issue with the configuration. To mitigate this, look for the config of keepalived.conf . change entry from : vrrp_strict  to become : vrrp_accept This entry will make keepalived will not use iptables. Keepalived version we use was V1....

Monday, 2 July 2018

Environment variable with ChicagoBoss

On Chicagoboss I need to have some configuration variable set in the main configuration. Just like my experience with Django framework on settings.py In Chicagoboss, we can do it also and add our on config variable in the configuration file, which are boss.config. These below are the part of the config we can custom : %% APPLICATION CONFIGURATIONS %% domains - A list of domains to serve the application on %% static_prefix - The URL prefix of static assets %% doc_prefix - The URL prefix for developer documentation { myapp, [ {path, "../myapp"}, {base_url, "/"}, {dummy, true} ]} So we can add the variable for our application with...

Monday, 18 June 2018

Generate a list from atom and string

On Erlang, there is no string data type, but its a list of strings. So different with other language. Also some function return an atom, which usually we need to combine it with our string. For example was the need to generate an sql query from an input parameter and our hard coded string. Let say we generate a year from erlang fun, then from that year, we generate the month and data. To do this properly are : {{Year,_,_},_} = calendar:universal_time(), Y1 = io_lib:format("~p-01-01",[Year]), Y2 = lists:flatten(Y1), Y2 result will be  "2018-06-18" Hope this helps, as i look all around the google for th...

Wednesday, 13 June 2018

Posgresql reporting query

With PostgreSQL when doing with datetime for reporting, it realy help if the DB can aggregate your needed data rather than process it yourself. I found this interesting and useful as i start needed query for reporting from my dataset. For example i want to have a list of records which user register per month. With postgresql here is the query : SELECT date_trunc('month', created_at), count(*) FROM users GROUP BY 1 ORDER BY 1 DESC; With date_trunc PostgreqSQL do its magic and return you the needed data without doing a query per month. really not so effective query. To get per week activity : with months as ( select month ...

Sunday, 29 April 2018

Using Centos 5.x repo after EOL

We know Centos 5.x already EOL , and no update given. But we sometimes still use the version as upgrade will be broke our application usage. So problem arise when we need to install application package in that version. The repo is moved from main url of the release, and moved to vault.centos.org . To able to install from your yum package manager , we need to update the yum base url. Here are some command to fix it. sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo sed -i 's|#baseurl=http://mirror.centos.org/centos/$releasever|baseurl=http://vault.centos.org/5.11|'...

Thursday, 29 March 2018

To add a Vlan in a VMware cluster in 1 line of command

One task as a Vmware admin was to add a network Vlan on the ESXi server you manage. How are you going to update a cluster with more than 10 server ? Simple way was access the Vcenter and do it 1 by 1 on network config. Really ? Can we do like a linux machine, update on 1 command and then enter ? Get friend with the Vsphere CLI , you can do a batch update on a cluster. Here are command to add a vlan in a Vmware cluster using Vsphere CLI. Connect-VIServer vcenter01.localnetwork.localget-cluster -name datacenter01 | Get-VMHost | Get-VirtualSwitch -name “vSwitch1” | New-VirtualPortGroup -Name “Srv.SecureServers” -VLanId “1337” You will be thankfull...

Tuesday, 6 March 2018

Docker the new best friend of developer

Docker Logo Recently i had review some Docker talks in youtube, and curious what it's value for me to learn it. So Docker is some package manager like vagrant, which ships code easily, or like to say same with puppet / chef out there. And this time , seems docker differentiate it with Virtualization and claim more better and efficient. Like Git which only updates the changes part, so its efficient on storage and speed. Also Docker based on Go,...

Page 1 of 2512345Next
Twitter Delicious Facebook Digg Stumbleupon Favorites More