<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by William on Medium]]></title>
        <description><![CDATA[Stories by William on Medium]]></description>
        <link>https://medium.com/@pluswn?source=rss-d7a17a28a987------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by William on Medium</title>
            <link>https://medium.com/@pluswn?source=rss-d7a17a28a987------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:51:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pluswn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zero Downtime — Data in Microservices architecture series (Part 2)]]></title>
            <link>https://medium.com/ralali-engineering/zero-downtime-data-in-microservices-architecture-series-part-2-e975d2a6f8e0?source=rss-d7a17a28a987------2</link>
            <guid isPermaLink="false">https://medium.com/p/e975d2a6f8e0</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[deployment-automation]]></category>
            <category><![CDATA[deployment-model]]></category>
            <dc:creator><![CDATA[William]]></dc:creator>
            <pubDate>Fri, 06 Sep 2019 11:09:25 GMT</pubDate>
            <atom:updated>2019-11-28T06:10:05.235Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zero Downtime — Data in Microservices architecture series (Part 2)</h3><p>This post is the second part of Data in Microservices Architecture series. You can find the prequel <a href="https://medium.com/ralali-engineering/data-in-microservices-architecture-introduction-c1762860c873">here</a>.</p><p>When you release a new version of your software to your customers, one thing you want is not to disrupt their activities. That is what zero downtime is all about in your software deployment pipeline.</p><p>Without zero downtime you would schedule the hours of the day when you think your users are less active in your software. With zero downtime, you will have the ability to deploy at any time of the day, multiple times and with small batches of change.</p><p>In my previous post, I mentioned that the main driver on why <a href="http://www.ralali.com/">Ralali.com </a>moving to microservices is to decreasing our lead time and reducing the changes in software releases. In the near future, I envisioned Ralali.com system, that empowering MSMEs, is a distributed system with a lot of moving parts where unavailability caused by a broken deployment of one of its parts is not allowed.</p><h3>Deployment Architectures</h3><p>The load balancer has become a default in Ralali.com deployment architecture. This is a good starting point for us to exercise two deployment strategies that could help us to achieve zero downtime.</p><h4>Blue/Green Deployment</h4><p><em>Fun fact: Since May 2019 Ralali.com moved into the ‘Blugreen’ building in West Jakarta.</em></p><figure><img alt="The Blue/Green Deployment" src="https://cdn-images-1.medium.com/max/1000/0*wiXNRO_6N1mSxqJ7" /><figcaption><em>The Blue/Green Deployment</em></figcaption></figure><p>When you choose blue/green deployment you will have two different releases, current and new version of your application running concurrently. Both releases are running on two identical environments with each being capable of handling 100% of your incoming traffic on its own. This is represented by the blue and green deployments where blue as the current version and green is the new version of your software.</p><p>In a common scenario, the load balancer is forwarding requests to the blue deployment. After you completed a deployment of the new version in the green deployment, you can configure the load balancer to forwarding requests to the green deployment and stop forwarding to the blue one. The change must be made on-the-fly to avoid requests lost.</p><p>When you found anything wrong with the green deployment, you can reconfigure the load balancer to forwarding requests back to the blue deployment without having to wait for it to be deployed again. This reduces the risk of your software deployment process.</p><p>One important aspect of the blue/green deployment strategy is your software releases must have forward and backward compatibility so both versions can coexist at the same time. This means two things to ensure. First, you code that exposed APIs must retain compatibility. To gain this, you must implement API versioning rigorously. Second, the data (state) must be readable and writable by both versions in a consistent state.</p><h4>Canary Deployment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*5o8NKEbP5afw4w-5" /><figcaption><em>Fantastic coal and where to find them</em></figcaption></figure><p>You are a coal miner from many years ago where you don’t have the luxury to use modern sensor safety equipment. A common problem that presents to you is toxic gases that build up in the coal mines and some of them are not have an odor. So how would you alert yourself when the dangerous gases check-in? You bring caged canaries into the mines. While the canaries singing cheerfully you can assure the air you breath is fine. If the canary died, then you know it is your time to get out fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*FB6AyHnEqGAg4v5u" /><figcaption><em>…at all the sudden, they are gone</em></figcaption></figure><p>The canary deployment borrows the above analogy. The most important things are gradual deployment and monitoring. By gradual deployment, you would forward a small percentage of the traffic to the new version of your software. When you see nothing goes wrong then you would gradually add more traffic. If you see something is wrong, you roll back 100% of the traffic to the current version of your software.</p><p>To be able to route a certain percentage of the traffic to your software and to roll back when something goes wrong, you need a smart router or implement a feature-toggle framework. The feature-toggle framework allows you to choose which part of your software will be enabled to a certain percentage or group of users.</p><p>—</p><p>If you enjoy this post and want to be part of the Ralali.com mission to empower businesses and people in Indonesia, why don’t you visit our <a href="https://careers.ralali.com/"><strong>Career Page </strong></a>and see where you can fit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e975d2a6f8e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ralali-engineering/zero-downtime-data-in-microservices-architecture-series-part-2-e975d2a6f8e0">Zero Downtime — Data in Microservices architecture series (Part 2)</a> was originally published in <a href="https://medium.com/ralali-engineering">Ralali Tech Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data in Microservices Architecture — Introduction]]></title>
            <link>https://medium.com/ralali-engineering/data-in-microservices-architecture-introduction-c1762860c873?source=rss-d7a17a28a987------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1762860c873</guid>
            <category><![CDATA[insights]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[William]]></dc:creator>
            <pubDate>Tue, 30 Jul 2019 07:42:16 GMT</pubDate>
            <atom:updated>2019-07-30T07:42:16.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Martin Fowler in his article about monolith-first approach" src="https://cdn-images-1.medium.com/max/1024/1*UYNNAg9bCqV9XBjnMK77bw.png" /><figcaption>Martin Fowler in his article about monolith-first approach</figcaption></figure><h3>Data in Microservices Architecture — Introduction</h3><p>This post is the first part of Data in Microservices architecture series that will not talk about concerns that are usually present in a discussion about microservices such as configuration management, service discovery or load balancing. We will bring your attention on the data. A critical part of a system that often barely involved when discussing microservices.</p><h4>Why Microservices?</h4><p>Even though the term “microservices” has been around since 2011, the surrounding discussion never gets old. Many organisations, as they learn the benefit for their business, identify their need to adopt microservices into their software development technique. Technology like Kubernetes boost the adoption momentum even further as it addresses many microservices implementation concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQp4sLFdQk4PeHJtbpWvAQ.png" /></figure><p>The feedback loop is an important process in human development, so does for software. As with everything we do in life, the longer the feedback loop, the worse the results are. Before we have real time syntax highlighting in our Integrated Development Environment (IDE), we should compile our code to check if the syntax was correct. Before automated testing tools, we have to wait for the tester team to inform us if our works broke anything. These are some examples of how reducing the lead time generated better results in the software development process.</p><p>One of the improvement areas for the feedback loop is microservices. Another one that tightly related with microservices is DevOps. If you are new to microservices, we recommend you to start with DevOps. Let us give you a short introduction.</p><h4>DevOps</h4><p>We need the DevOps team, which objective is to make the entire teams of software development fully own their work, both on the Developer (Dev) and Operations (Ops) side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*4i8zO1K50uUnsYFj" /></figure><p>They must be responsible for the outcomes of the application. This responsibility is rather to fulfill a common expectation that every business build: a software release with no bugs.</p><blockquote>But just like Thanos, bugs are inevitable.</blockquote><p>Changes introduced, both in code and environment, cause bugs. And changes is a certainty in a growing business. So what more realistic as the outcomes from a software development team is a release with fewer bugs. Because changes causes bugs, so that smaller changes should introduce fewer bugs. Smaller changes also make it easier to spot the source of bugs. Therefore, it should be easier to fix them.</p><p>DevOps is a combination of culture, processes and tools that enable an organisation to release software faster. The sooner we release the feature, the faster feedback acquired. To deliver it faster, organisation must reduce the size of the changes in each release.</p><p>And remember, smaller changes lead to fewer bugs.</p><p>To deliver the software with fewer bugs, organisation need an automated software deployment pipeline. Ranging from the code repository run through to the production infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2NjMQyoB4_W6pRuZazwtTw.png" /></figure><h4>Why microservices?</h4><p>Scalability is one of the reasons why you want to adopt microservices. Another reason is regarding to decreasing our lead time and reducing the changes of software releases. Currently Ralali.com ultimately adopt the second reason.</p><p>By adopting this system, we split a monolithic codebase into a smaller loosely coupled part, colloquially known as <strong>microservice</strong>. Each part will have a separate service functionality. Because those microservices is loosely coupled, we release them gradually. By doing that, we improve our lead time and change size of the feature.</p><h4>How to start microservices?</h4><p>In his article on monolith-first approach, Martin Fowler<a href="https://martinfowler.com/bliki/MonolithFirst.html"> suggests</a> that you shouldn’t start a new project with microservices, even if you’re sure your application will be big enough to make it worthwhile.</p><p>That approach requires you to have a stable monolith. This will help you define boundaries between the domain model. Wrong boundaries will force you to deal with cascading changes and bugs. There is even a name for the pattern:<a href="https://martinfowler.com/bliki/StranglerFigApplication.html"> strangler pattern</a>. Basically, you would start small with microservices and grow around a monolith.</p><p>How to choose we should split which part of the monolith out as a microservice? This is where Domain-Driven Design comes handy.</p><h4>Domain-Driven Design</h4><p>Domain-Driven Design (DDD) is an approach to software development that tackles complex systems by mapping activities, tasks, events, and data from a business domain to software artifacts (in our context: microservices).</p><p>Failure in splitting a piece of a monolith will lead us to have a microservice that depends too much on information confined in another microservice. Worse, this also could force us to synchronize changes from a microservice to another microservice.</p><p>Having a stable monolith will help us decide the bounded contexts of our domain model. This is essential because we should have mature knowledge around our business domain model first.</p><p>What is a domain model?</p><p>Things that are grouped together and achieve high cohesion and low coupling. When you just develop a software system for your business, it is hard to define which of the system changes together and which one’s change separately.</p><h4>Microservices characteristics</h4><p>Martin Fowler suggested a common set of characteristics of the<a href="https://www.martinfowler.com/articles/microservices.html"> microservices</a> architectures. Each characteristic worth its own explanations. Since we have told you about how data should be managed in microservices architecture in this article, so the next big thing about single characteristic that we will discuss is:<strong> why each microservices should have its own database</strong>.</p><p><em>If you enjoy this post and want to be part of the Ralali.com Engineering team building the data management in the microservices architecture as part of the mission to empower MSMEs and people in Indonesia, why don’t you visit our</em><a href="https://careers.ralali.com/"><em> Career page</em></a><em> and see where you can fit.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1762860c873" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ralali-engineering/data-in-microservices-architecture-introduction-c1762860c873">Data in Microservices Architecture — Introduction</a> was originally published in <a href="https://medium.com/ralali-engineering">Ralali Tech Stories</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MariaDB Load Balancing with HAProxy on Centos 7]]></title>
            <link>https://medium.com/pull-requests/mariadb-load-balancing-with-haproxy-on-centos-7-7e72d41dca8d?source=rss-d7a17a28a987------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e72d41dca8d</guid>
            <category><![CDATA[haproxy]]></category>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[mariadb]]></category>
            <category><![CDATA[load-balancing]]></category>
            <dc:creator><![CDATA[William]]></dc:creator>
            <pubDate>Wed, 04 Jan 2017 16:17:42 GMT</pubDate>
            <atom:updated>2017-01-30T10:05:37.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*KBB3kPWFDERZ9oybNiXHpQ.jpeg" /><figcaption><a href="https://www.flickr.com/photos/fivefurlongs/7821017374/in/photolist-cV7KZ9-gGx5B-3A7x9C-o6YUrL-9jn4hY-6Ls3Z8-8seAkD-fmHL9z-7FZLqd-aHUnD-7FZKiC-9jnZo7-i6ZSh9-7FZLaw-9jjRPK-bsuiSp-W8zNC-6pGmH2-7Ra6p7-k691G-4tn245-9jjPK6-4Cwhc-8rcr4C-7FZKB3-7sHVKS-6LwcW3-9FrG9m-73xQ1W-6Lwdjj-bviPnW-9jjQP6-efXmHN-dxWpAG-3yXFnN-5ywiUu-oaGDyC-6o6GKC-98PX1U-3KDuoV-9atKh8-9avBtJ-bjAitb-c8obi-8iELw-7a7dGC-G7tX5-6Ls3A2-bGjc3B-JgfE">Seal by Five Furlongs</a> © <a href="https://creativecommons.org/licenses/by-nd/2.0/">Some rights reserved</a>.</figcaption></figure><p>Tutorial on how to setup MariaDB 5.5 Load Balancing with HAProxy 1.5 on Centos 7 using 3 server instances (2 for MariaDB and 1 for HAProxy).</p><h4>Prepare MariaDB Servers</h4><p>On each MariaDB server, edit your /etc/hosts so that they can ping each others via the hostname.</p><pre>10.140.0.1 mariadb1<br>10.140.0.2 mariadb2</pre><p>On each MariaDB server, install mariadb-server package and harden the installation</p><pre># yum install mariadb-server<br># systemctl start mariadb<br># mysql_secure_installation</pre><p>On mariadb1 server, edit your /etc/my.cnf file and on the top enter the following parameter:</p><pre>[mysqld]<br>server-id=1<br>log-bin=mysql-bin</pre><p>Then restart the service</p><pre># systemctl restart mariadb</pre><p>Then login to MariaDB and create a user for replication slave followed by a flush privileges and the tables for read only access.</p><pre>MariaDB [(none)]&gt; GRANT REPLICATION SLAVE ON *.* to replicator@’%’ IDENTIFIED BY ‘secret’;<br>MariaDB [(none)]&gt; FLUSH PRIVILEGES;<br>MariaDB [(none)]&gt; FLUSH TABLES WITH READ LOCK;</pre><p>At this point, if you do a show master status, you need to have a file with the mysql-bin incrementing number as well a position number.</p><pre>MariaDB [(none)]&gt; SHOW MASTER STATUS;<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>| mysql-bin.000004 | 466 | | |<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>1 row in set (0.00 sec)</pre><p>On mariadb2, edit your /etc/my.cnf file and on top enter the following parameter:.</p><pre>[mysqld]<br>server-id=2</pre><p>Then restart the service</p><pre># systemctl restart mariadb</pre><p>Back to mariadb1, dump the mysql database and import it to mariadb2</p><pre>$ mysqldump -u root -p --database mysql &gt; mysql.sql<br>$ scp mysql.sql user@mariadb2:~/</pre><p>On mariadb2</p><pre>$ mysql -u root -p --database mysql &lt; mysql.sql </pre><p>Login to MariaDB and we will temporarily run mariadb2 as slave.</p><pre>MariaDB [(none)]&gt; CHANGE MASTER TO MASTER_HOST=’mariadb1&#39;, MASTER_USER=’replicator’, MASTER_PASSWORD=’secret’, MASTER_LOG_FILE=’mysql-bin.000001&#39;, MASTER_LOG_POS=466;<br>MariaDB [(none)]&gt; START SLAVE;</pre><p>Value for the MASTER_LOG_POS is from the Position in the result when you run show master status. At this point, you would noticed that the Slave is running correctly by verifying with a show slave status</p><pre>MariaDB [(none)] SHOW SLAVE STATUS;</pre><p>Now that mariadb1 is the master and mariadb2 is the slave, we will perform the reverse order to reach our goal. At this level, you can unlock the tables (on mariadb1) which we did previously.</p><pre>MariaDB [(none)] UNLOCK TABLE;</pre><p>On mariadb2 (which is actually a slave), re-edit the my.cnf file and under the [mysqld] and server-id add the following parameter. It should look like this</p><pre>[mysqld]<br>server-id=2<br>log-bin=mysql-bin</pre><p>Then restart</p><pre># systemctl restart mariadb</pre><p>Login to the MariaDB and execute a show master status</p><pre>MariaDB[(none)] SHOW MASTER STATUS;<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>| mysql-bin.000001 | 245 | | |<br>+ — — — — — — — — — + — — — — — + — — — — — — — + — — — — — — — — — +<br>1 row in set (0.00 sec)</pre><p>On mariadb1, a show slave status will prompt you an empty set. Now since we have dump the mysql database to mariadb2, we can now just run mariadb1 as slave.</p><pre>MariaDB[(none)] CHANGE MASTER TO MASTER_HOST=’mariadb2&#39;, MASTER_USER=’replicator’, MASTER_PASSWORD=’secret’, MASTER_LOG_FILE=’mysql-bin.000001&#39;, MASTER_LOG_POS=245;<br>MariaDBp(none)] START SLAVE;</pre><p>Test by creating database and tables on both servers, it will replicate on each other.</p><p>Now login to one of the MariaDB server and create user for HAProxy</p><pre>MariaDB[(none)] INSERT INTO mysql.user (Host,User) values (‘10.140.0.4’,’haproxy_check’); FLUSH PRIVILEGES;<br>NariaDB[(none)] GRANT ALL PRIVILEGES ON *.* TO ‘haproxy_root’@’10.140.0.4&#39; IDENTIFIED BY ‘secret’ WITH GRANT OPTION; FLUSH PRIVILEGES</pre><p>Please note that 10.140.0.4 is the HAProxy server IP.</p><h4>Configuring HAProxy</h4><p>Install HAProxy</p><pre># yum install haproxy</pre><p>Backup the original configuration file</p><pre># mv /etc/haproxy/haproxy.cfg{,.original}</pre><p>Create a new one</p><pre># vi /etc/haproxy/haproxy.cfg</pre><p>Paste configuration below</p><pre>global<br>    log 127.0.0.1 local0 notice<br>    user haproxy<br>    group haproxy</pre><pre>defaults<br>    log global<br>    retries 2<br>    timeout connect 3000<br>    timeout server 5000<br>    timeout client 5000</pre><pre>listen mysql-cluster<br>    bind 10.140.0.4:3306<br>    mode tcp<br>    option mysql-check user haproxy_check<br>    balance roundrobin<br>    server mysql-1 10.140.0.2:3306 check<br>    server mysql-2 10.140.0.3:3306 check</pre><p>In my case, 10.140.0.4 is my HAProxy server IP.</p><p>Start HAProxy</p><pre># setsebool -P haproxy_connect_any=1<br># systemctl start haproxy</pre><p>Test connection to MariaDB servers through HAProxy</p><pre>$ mysql -u haproxy_root -p -h 10.140.0.4</pre><p>Testing Failover</p><p>Stop one of the MariaDB server service:</p><pre># systemctl stop mariadb</pre><p>You should still be able to connect to MariaDB through HAProxy</p><pre>$ mysql -u haproxy_root -p -h 10.140.0.4</pre><h4>Further Reading</h4><ul><li><a href="http://www.haproxy.org/">HAProxy</a></li><li><a href="https://mariadb.com/kb/en/mariadb/replication-cluster-multi-master/">Replication, Cluster, &amp; Multi-Master</a></li><li><a href="http://tunnelix.com/simple-master-master-replication-on-mariadb/">Simple Master-Master replication on MariaDB</a></li><li><a href="https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-mysql-load-balancing--3">How To Use HAProxy to Set Up MySQL Load Balancing</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e72d41dca8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pull-requests/mariadb-load-balancing-with-haproxy-on-centos-7-7e72d41dca8d">MariaDB Load Balancing with HAProxy on Centos 7</a> was originally published in <a href="https://medium.com/pull-requests">Pull Requests</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>