<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>patg.net</title>
		<description>Patg.net website</description>		
		<link>http://patg.net</link>
		<atom:link href="http://patg.net/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Clickhouse S3</title>
				<description>
&lt;h1 id=&quot;clickhouse-database-imports-data-from-s3&quot;&gt;Clickhouse Database Imports data from S3!&lt;/h1&gt;

&lt;p&gt;I have been trying out the Clickhouse Database for a few weeks now and really impressed. For those who don’t know, ClickHouse is a high-performance, columnar-oriented database management system designed primarily for real-time analytics. It was developed by Yandex and is known for its ability to process very large volumes of data quickly while using minimal system resources. ClickHouse excels in handling analytical queries with high throughput and low latency, making it a popular choice for big data, log analysis, time-series data, and online analytical processing (OLAP) tasks. Companies such as &lt;a href=&quot;&apos;https://altinity.com&apos;&quot;&gt;Altinity&lt;/a&gt;, &lt;a href=&quot;&apos;http://clickhouse.com&apos;&quot;&gt;Clickhouse&lt;/a&gt;, (first two who offer SaaS around Clickhouse) Craigslist, Dashdive, Deutsche Bank, and many others. &lt;a href=&quot;&apos;https://github.com/ClickHouse/ClickHouse&apos;&quot;&gt;The Github repo&lt;/a&gt; is a good place to get started.&lt;/p&gt;

&lt;p&gt;In using it, much of my background with MySQL and PostgreSQL has helped me, plus, it actually has interfaces for MySQL and PostgreSQL clients!&lt;/p&gt;

&lt;h2 id=&quot;s3-functionality&quot;&gt;S3 Functionality&lt;/h2&gt;

&lt;p&gt;One feature I find really interesting and useful is the ability to query data from AWS S3.&lt;/p&gt;

&lt;h3 id=&quot;setup&quot;&gt;Setup&lt;/h3&gt;

&lt;p&gt;Create a bucket:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws s3 mb s3://clickhouse-patg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy a gzipped TSV file with data (headers in this one as well)&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aws s3 cp data.tsv.gz s3://clickhouse-patg/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Set the server preferences with a file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/clickhouse-server/config.d/s3.xml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;clickhouse&amp;gt;
    &amp;lt;s3&amp;gt;
        &amp;lt;endpoint-name&amp;gt;
            &amp;lt;endpoint&amp;gt;https://clickhouse-patg.s3.amazonaws.com&amp;lt;/endpoint&amp;gt;
            &amp;lt;access_key_id&amp;gt;AKredacted&amp;lt;/access_key_id&amp;gt;
            &amp;lt;secret_access_key&amp;gt;xyzredacted&amp;lt;/secret_access_key&amp;gt;
            &amp;lt;!-- &amp;lt;use_environment_credentials&amp;gt;false&amp;lt;/use_environment_credentials&amp;gt; --&amp;gt;
            &amp;lt;!-- &amp;lt;header&amp;gt;Authorization: Bearer SOME-TOKEN&amp;lt;/header&amp;gt; --&amp;gt;
        &amp;lt;/endpoint-name&amp;gt;
    &amp;lt;/s3&amp;gt;
&amp;lt;/clickhouse&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Restart the server (Ubuntu 24.04)&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemctl restart clickhouse-server.service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Query the table!&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
clickhouse-client --password # uses &apos;default&apos; user and password set on install

myhost.internal :) select * from s3(&apos;https://clickhouse-patg.s3.amazonaws.com/data.tsv.gz&apos;,&apos;TabSeparatedRaw&apos;) limit 10;

SELECT *
FROM s3(&apos;https://clickhouse-patg.s3.amazonaws.com/data.tsv.gz&apos;, &apos;TabSeparatedRaw&apos;)
LIMIT 10

Query id: 3b587b74-4803-48e1-9492-13042794de55

   ┌─id	stringval	digit────────────────────┐
1. │ 0	nvlpuJWZ78rM4Ma9	3.5153584288539355 │
2. │ 1	4NY8I0R1DAjVGGHO	26.154132477041742 │
3. │ 2	9rof1FJDFg3CvAb6	60.927590847441266 │
4. │ 3	Nx1jGSRf8VOh5TSS	84.07472488753888  │
5. │ 4	PWriUaORQc32mbcP	78.96101702751513  │
6. │ 5	DxJmb0ASVZiGIeef	17.171794187401467 │
7. │ 6	fy5peZZeJqwMpt5Q	38.114516479322496 │
8. │ 7	A0LeX5v7WghiFbva	30.961514875964678 │
9. │ 8	Bqi2IInBlisHSYeS	35.935753912623916 │
   └──────────────────────────────────────────────────┘
    ┌─id	stringval	digit────────────────────┐
10. │ 9	KNHLNmxFRMAPKRMr	52.692043323314586 │
    └──────────────────────────────────────────────────┘

10 rows in set. Elapsed: 1.111 sec. 

infra.cs342cloud.internal :) 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, insert the data from S3 into a table on the server with this data:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
INSERT INTO testdata (id, stringval, digit) SELECT *
FROM s3(&apos;https://clickhouse-patg.s3.amazonaws.com/data.tsv.gz&apos;, &apos;TabSeparatedRaw&apos;)

Query id: 72031373-f4bd-4fab-9164-9f5df6b30036

Ok.

0 rows in set. Elapsed: 2.718 sec. Processed 2.00 million rows, 66.00 MB (735.87 thousand rows/s., 24.28 MB/s.)
Peak memory usage: 123.58 MiB.

myhost.internal :) select * from testdata limit 10;

SELECT *
FROM testdata
LIMIT 10

Query id: 74ca3a98-0f06-4e01-9bdc-812d9b8048dd

    ┌─id─┬─stringval────────┬─────digit─┐
 1. │  0 │ nvlpuJWZ78rM4Ma9 │ 3.5153584 │
 2. │  1 │ 4NY8I0R1DAjVGGHO │ 26.154133 │
 3. │  2 │ 9rof1FJDFg3CvAb6 │  60.92759 │
 4. │  3 │ Nx1jGSRf8VOh5TSS │  84.07472 │
 5. │  4 │ PWriUaORQc32mbcP │  78.96101 │
 6. │  5 │ DxJmb0ASVZiGIeef │ 17.171795 │
 7. │  6 │ fy5peZZeJqwMpt5Q │ 38.114517 │
 8. │  7 │ A0LeX5v7WghiFbva │ 30.961515 │
 9. │  8 │ Bqi2IInBlisHSYeS │ 35.935753 │
10. │  9 │ KNHLNmxFRMAPKRMr │ 52.692043 │
    └────┴──────────────────┴───────────┘

10 rows in set. Elapsed: 0.006 sec. 

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Very cool indeed!&lt;/p&gt;

&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;/h1&gt;

&lt;p&gt;Clickhouse is an amazing database thus far, and as shown above, one of the many things it can do is utilize data in S3, in this example, query or insert.&lt;/p&gt;

&lt;p&gt;Stay tuned for more!&lt;/p&gt;
</description>
				<pubDate>Tue, 08 Oct 2024 00:00:00 +0000</pubDate>
				<link>http://patg.net/2024/10/08/clickhouse-s3/</link>
				<guid isPermaLink="true">http://patg.net/2024/10/08/clickhouse-s3/</guid>
			</item>
		
			<item>
				<title>Godaddy Terraform</title>
				<description>
&lt;h1 id=&quot;using-terraform-with-godaddy&quot;&gt;Using Terraform With Godaddy&lt;/h1&gt;

&lt;p&gt;So, to start off this post, I haven’t posted on my blog for, a while. I had just been super busy both at Oracle Cloud and then in the role of CTO and CIO at Parler, which after a day of work, and having kids at the premium age for interaction, and I suppose fatigue from being in this industry since 1993, and really technical field going back to the day I went into the Navy in 1986, you get the point!&lt;/p&gt;

&lt;p&gt;In any case, one of the things I thought about when I was climbing Aconcagua and spending time with Peter Zaitsev, who is a tremendous person both professionally as well as in general, I want to get back to contributing to the open-source and technical community. I wrote two books and can put out material quickly when I get down to it, so here goes the resumption of that endevour.&lt;/p&gt;

&lt;h2 id=&quot;why-this-post&quot;&gt;Why this post?&lt;/h2&gt;

&lt;p&gt;One of the things I’ve been needing to do, especially to keep my skills up to date, is to refresh some of my knowledge on using cloud-specific technologies. For the last three years, I’ve been working in environments where we had to build our own infrastucture and not having the luxury of using tools like Terraform, or using AWS, though I have written books of Ansible to manage databases (MySQL and Postgres) as well as various varieties of do-it-yourself Kubernetes clusters.&lt;/p&gt;

&lt;p&gt;The first task I wanted to do was to build my own EKS Kubernetes cluster and use a domain I have, which happens to be “kubernetes-cluster.com” (I obtained it in early days). To do this, I realized I needed to modify my NS records for that domain, which the registrar is Godaddy, and I want to use Route 53 to manage it and in turn, use External DNS with Kubernetes.&lt;/p&gt;

&lt;p&gt;I thought “OK, I have two things I need to do that can be done with one project. Modify the kubernetes-cluster.com’s NS records &lt;em&gt;and&lt;/em&gt; do something useful with Terraform. And for sure, there was a provider for Godaddy!&lt;/p&gt;

&lt;h1 id=&quot;the-godaddy-provider-for-terraform&quot;&gt;The Godaddy Provider for Terraform&lt;/h1&gt;

&lt;p&gt;The Goddady Provider for Terraform is incredibly simple to use. For the sake of getting this blog post done, I’m just going to show you the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main.tf&lt;/code&gt; file that I created to change the nameservers for kubernetes-cluster.com to use AWS’s Route53 DNS. I had never used this provider before, so there is no existing state, but simply specifying the nameservers for Route53, it replaced the old nameservers with what I wanted.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main.tf&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;terraform {
  required_providers {
    godaddy = {
      source = &quot;n3integration/godaddy&quot;
      version = &quot;1.9.1&quot;
    }
  }
}

provider &quot;godaddy&quot; {
  # Configuration options
}

provider &quot;aws&quot; {
  region  = &quot;us-west-2&quot;
  profile = &quot;default&quot;

  backend s3 {
    bucket = &quot;tf-godaddy-state&quot;
    key    = &quot;domains/kubernetes_cluster_com&quot;
    region = &quot;us-east-1&quot;
  }
}
resource &quot;godaddy_domain_record&quot; &quot;kubernetes_cluster_com&quot; {
  domain   = &quot;kubernetes-cluster.com&quot;

  // your Godaddy customer ID obviously
  customer = &quot;123456788888888&quot;

  // AWS nameservers specified in Route53
  nameservers = [&quot;ns-526.awsdns-01.net&quot;,&quot;ns-1521.awsdns-62.org&quot;,&quot;ns-1975.awsdns-54.co.uk&quot;,&quot;ns-5.awsdns-00.com&quot;]

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform init&lt;/code&gt; (I use an alias &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tf&lt;/code&gt; set in my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt;)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ tf init

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of n3integration/godaddy from the dependency lock file
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed n3integration/godaddy v1.9.1
- Using previously-installed hashicorp/aws v5.45.0

Terraform has been successfully initialized!

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then of course, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform plan&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tf plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  + create

Terraform will perform the following actions:

  # godaddy_domain_record.kubernetes_cluster_com will be created
  + resource &quot;godaddy_domain_record&quot; &quot;kubernetes_cluster_com&quot; {
      + customer    = &quot;12345678&quot;
      + domain      = &quot;kubernetes-cluster.com&quot;
      + id          = (known after apply)
      + nameservers = [
          + &quot;ns-526.awsdns-01.net&quot;,
          + &quot;ns-1521.awsdns-62.org&quot;,
          + &quot;ns-1975.awsdns-54.co.uk&quot;,
          + &quot;ns-5.awsdns-00.com&quot;,
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then of course run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform apply&lt;/code&gt;. I won’t include that output for the purpose of brevity, and because it’s what you’d expect.&lt;/p&gt;

&lt;p&gt;Import to note: after I changed the nameservers from Goddady providing DNS, this makes it so that Goddady no longer has a zone file for kubernetes-cluster.com and is only serving as a registrar, so I can’t use the Terraform provider if I want to make changes to the domain and will need to use the Route53 terraform provider.&lt;/p&gt;

&lt;p&gt;I also used this provider for adding a cname for patg.net:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;resource &quot;godaddy_domain_record&quot; &quot;patg-net&quot; {
  domain   = &quot;patg.net&quot;

  // required if provider key does not belong to customer
  customer = &quot;12345678&quot;

  record {
    name = &quot;blog&quot;
    type = &quot;CNAME&quot;
    data = &quot;patg.net&quot;
    ttl = 3600
  }

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Again, quite simple, using the same steps (init, plan, apply) and being only adding a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CNAME&lt;/code&gt;, I can continue to use this provider.&lt;/p&gt;

&lt;p&gt;Have a great day, and thanks for reading my post!&lt;/p&gt;
</description>
				<pubDate>Tue, 16 Apr 2024 00:00:00 +0000</pubDate>
				<link>http://patg.net/2024/04/16/godaddy-terraform/</link>
				<guid isPermaLink="true">http://patg.net/2024/04/16/godaddy-terraform/</guid>
			</item>
		
			<item>
				<title>Get Password</title>
				<description>&lt;p&gt;Here is a nice one-liner to get the password and username set in a kubernetes secret for the Grafana UI after installing Prometheus:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kubectl get secret patg-prometheus-stack-grafana -o json|jq &apos;.data.&quot;admin-password&quot;&apos;|sed -e &apos;s/&quot;//g&apos;|base64 -D&lt;/code&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 16 Apr 2024 00:00:00 +0000</pubDate>
				<link>http://patg.net/2024/04/16/get-password/</link>
				<guid isPermaLink="true">http://patg.net/2024/04/16/get-password/</guid>
			</item>
		
			<item>
				<title>Running XtraBackup on Windows using WSL</title>
				<description>&lt;h2 id=&quot;backing-up-mysql-on-windows-options&quot;&gt;Backing up MySQL on Windows: options?&lt;/h2&gt;

&lt;p&gt;I had a recurring consultation this summer with a client who is running a stand-alone MySQL database with a ton of data and wanted to simply have a backup system for that data. The client is very risk-averse and didn’t want anything too experimental. I knew for a huge database, I didn’t want to run mysqldump on the database on a regular basis if I could avoid it and always prefer using XtraBackup.&lt;/p&gt;

&lt;p&gt;I haven’t worked on Windows in years, and had assumed there were binaries for XtraBackup, but as with so many things with Windows, there are a million assumptions I had made prior that I have learned the hard way throughout the summer.&lt;/p&gt;

&lt;p&gt;I did find Vadim’s excellent &lt;a href=&quot;https://www.percona.com/blog/2017/03/20/running-percona-xtrabackup-windows-docker/&quot;&gt;article&lt;/a&gt; using a Docker container to run a container with XtraBackup, and bind mounts of both the datadir and the backup directory so the container can run a backup and have the backup show up on the host where specified in the arguments. This is certainly the way I gravitate to as I find containers a great solution to so many problems. However, again, I mentioned the client wanted something that isn’t perceived to be to experimental, so I wanted to explore using something that was “part” of Windows.&lt;/p&gt;

&lt;h2 id=&quot;wsl-windows-subsystem-for-linux&quot;&gt;WSL: Windows Subsystem for Linux&lt;/h2&gt;

&lt;p&gt;Microsoft certainly is a different company than it used to be. Microsoft has really put a &lt;a href=&quot;https://opensource.microsoft.com/&quot;&gt;lot of work into being part of Open Source&lt;/a&gt;, VSCode, the container ecosystem, Kubernetes, Open-Sourcing PowerShell, etc. Also one can consider the context of Microsoft being serious about attracting developers to their platform. In addition to these other efforts, my friend James Hancock, an expert in all things Windows, told me about WSL, the Windows Subsystem for Linux.&lt;/p&gt;

&lt;p&gt;I had always known that Windows had this idea of a base kernel with subsytems, both a Windows subsystem as well as a POSIX subsystem. I hadn’t used Windows much in years, so I didn’t know the status of what you could do with Windows in current times.&lt;/p&gt;

&lt;p&gt;WSL was an effort inside of Microsoft researching real time translation of Linux system calls into Windows OS system calls, and derived from their work in working with &lt;a href=&quot;https://arstechnica.com/information-technology/2016/04/why-microsoft-needed-to-make-windows-run-linux-software/&quot;&gt;Android apps to run on Windows 10 Mobile&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what-is-wsl-really&quot;&gt;What is WSL really?&lt;/h2&gt;

&lt;p&gt;Throughout the years, there have been a number of ways to run “unix” or posix commands on Windows with some sort of bash shell for those who are Linux people to get by when working on Windows. WSL is much more than that though.&lt;/p&gt;

&lt;h4 id=&quot;wsl-is-not-cygwin-nor-mingw&quot;&gt;WSL is not CygWin nor MinGW.&lt;/h4&gt;

&lt;p&gt;Those are great tools, but not a complete subsystem like WSL that integrates into the Windows OS&lt;/p&gt;

&lt;h4 id=&quot;wsl-is-not-a-container-nor-vm-running-linux&quot;&gt;WSL is not a container nor VM running Linux&lt;/h4&gt;

&lt;p&gt;WSL is part of the OS, a subsystem just like Windows itself and equal footing and not just an accessory program&lt;/p&gt;

&lt;h4 id=&quot;wsl-is-currently-like-having-ubuntu-on-windows&quot;&gt;WSL is currently like having Ubuntu on Windows&lt;/h4&gt;

&lt;p&gt;When you run WSL, you have an Ubuntu installation you can do all the same things for the most part you would if you were running on a VM or bare metal.&lt;/p&gt;

&lt;p&gt;On WSL, there exists a regular Linux file system with Windows fixed drives mounted as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/&amp;lt;drive letter&amp;gt;&lt;/code&gt; so that you have access to you Windows files as well.&lt;/p&gt;

&lt;p&gt;It’s also an excellent development platform as now one can develop both for Windows or Linux.&lt;/p&gt;

&lt;h2 id=&quot;using-wsl&quot;&gt;Using WSL&lt;/h2&gt;

&lt;p&gt;It’s part of the Windows OS, so it just needs to be set up to run.&lt;/p&gt;

&lt;p&gt;Basically, it can be enabled through enabling developer mode and turning on the WSL feature in Settings-&amp;gt;Update &amp;amp; Security, as detailed in &lt;a href=&quot;https://solarianprogrammer.com/2017/04/15/install-wsl-windows-subsystem-for-linux/&quot;&gt;this article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or using a simple PowerShell command as detailed in &lt;a href=&quot;https://msdn.microsoft.com/en-us/commandline/wsl/install_guide&quot;&gt;this article&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It can also be run as a specific user if desired&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;LxRun.exe /setdefaultuser &amp;lt;new_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;what-does-wsl-mean-for-xtrabackup&quot;&gt;What does WSL mean for XtraBackup?&lt;/h2&gt;

&lt;p&gt;Since there aren’t any Windows binaries XtraBackup, one has to either use a Docker container or WSL.&lt;/p&gt;

&lt;p&gt;For WSL, it is Ubuntu. So, to install XtraBackup for WSL, install XtraBackup as it would be installed on Ubuntu! Yes, that easy.&lt;/p&gt;

&lt;h2 id=&quot;setting-up-xtrabackup-on-wsl&quot;&gt;Setting up XtraBackup on WSL&lt;/h2&gt;

&lt;p&gt;The current Ubuntu version for WSL is xenial, so that is the version, using lsb-release to get the right package version.The lsb package will need to be installed to make it work.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
apt-get install lsb
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo apt-get update
sudo apt-get install percona-xtrabackup-24
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The MySQL version on the server was installed from &lt;a href=&quot;https://bitnami.com/stack/wamp&quot;&gt;Bitnami’s WAMP&lt;/a&gt; package which installs MySQL in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Bitnami\wampstack-7.1.7-0\mysql\data&lt;/code&gt;, but we modified the datadir to be in C:\mysqldata, which is accessible as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt/c/mysqldata&lt;/code&gt; in WSL.&lt;/p&gt;

&lt;p&gt;The first thing is to decide where to back up data.&lt;/p&gt;

&lt;p&gt;IMPORTANT: the current version of Windows, WSL cannot access USB drives, so you if data needs to be on a detachable USB drive, it’ll need to be copied from the attached storage to the USB drive. The current insider release does address this and soon this problem won’t exist on regular releases.&lt;/p&gt;

&lt;p&gt;For a backup directory, In our case, we chose &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\backups&lt;/code&gt; for simplicity.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir /mnt/c/backups
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So, with a running MySQL instance and a place to create backups, XtraBackup can be run via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;innobackupex&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;innobackupex --datadir=/mnt/c/mysqldata /mnt/c/backups
innobackupex --apply-log /mnt/c/backups/2017-09-xxx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And That’s it! Now you can have yet another way to back up MySQL on Windows!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/wsl4.PNG&quot; alt=&quot;xtrabackup wsl&quot; /&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 03 Sep 2017 12:00:00 +0000</pubDate>
				<link>http://patg.net/mysql,windows/10,wsl,backups/2017/09/03/xtrabackup-wsl/</link>
				<guid isPermaLink="true">http://patg.net/mysql,windows/10,wsl,backups/2017/09/03/xtrabackup-wsl/</guid>
			</item>
		
			<item>
				<title>HAProxy Tip</title>
				<description>&lt;h2 id=&quot;question-how-do-i-have-haproxy-redirect-to-another-site-and-preserve-the-full-url&quot;&gt;Question: how do I have &lt;a href=&quot;http://www.haproxy.org/&quot;&gt;HAProxy&lt;/a&gt; redirect to another site and preserve the full URL?&lt;/h2&gt;

&lt;p&gt;I’ve been thinking: sometimes I feel that in order to post to my blog, it has to be significant. This runs contrary to the whole idea of “release early, release often” ideal in terms of documentation. Why not just post findings when they’re fresh in my mind? Here goes.&lt;/p&gt;

&lt;p&gt;Today, I had a client who needed one site redirect another site and retain the full URL on the web front-end, which uses &lt;a href=&quot;http://www.haproxy.org/&quot;&gt;HAProxy&lt;/a&gt;. The existing redirects would do this for other sites, but would redirect to the front page and if whatever the full URL was that was acccessed was lost.&lt;/p&gt;

&lt;p&gt;It was a pretty simple problem to solve, but not a lot of examples out there that were more complex.&lt;/p&gt;

&lt;h2 id=&quot;first-things-first&quot;&gt;First things first&lt;/h2&gt;

&lt;p&gt;When you test front-end proxy changes, disable your browswer’s cache! In Chrome, this is done with Dev tools-&amp;gt;Network-&amp;gt;check “Disable cache”. Other browswers can also have their cache disabled. Yes, I know, that seems obvious, but shift reload doesn’t work well nor is convenient when you cut-n-paste a URL from some other application or email to test your changes or have to explicitely clear it.&lt;/p&gt;

&lt;p&gt;Also, have a test proxy that you spin up to make changes on and use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt; to have it respond as the front-end web proxy.&lt;/p&gt;

&lt;h3 id=&quot;original-rules-in-haproxy&quot;&gt;Original rules in HAProxy&lt;/h3&gt;

&lt;p&gt;The original rule went to a subdirectory on the main site, but this needed to be changed to have it go to a completely different site&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;acl is_somesite hdr(host) -i somesite.com
redirect code 301 location http://www.mainsite.com/somesite/ if is_somesite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It now needed instead to go from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://somesite.com/path?query_string&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://anothersite.com/path?query_string&lt;/code&gt;. The former rule didn’t work as:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;redirect code 301 location http://www.anothersite.com if is_somesite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And would obviously go, regardless of the full URI, to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://www.anothersite.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After searching, reading the manual, and specifically for the version being used, this did the trick:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;acl is_somesite hdr_end(host) -i somesite.com
http-request redirect code 301 location http://www.anothersite.com%[capture.req.uri] if is_somesite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note the use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hdr_end(host)&lt;/code&gt;. The reason for this is it takes care of any subdomain and the main domain. Also, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%[capture.req.uri]&lt;/code&gt; is the real magic for ensuring the full URL is carried over.&lt;/p&gt;

&lt;p&gt;For the most recent version of HAProxy (7.0), it would be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;req.uri&lt;/code&gt; versus &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;capture.req.uri&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;

&lt;p&gt;So, there it is. Hopefully this will help others save time.&lt;/p&gt;

&lt;p&gt;More on &lt;a href=&quot;https://www.haproxy.com/doc/aloha/7.0/haproxy/http_redirection.html&quot;&gt;redirection with HAProxy&lt;/a&gt;&lt;/p&gt;
</description>
				<pubDate>Fri, 04 Aug 2017 12:00:00 +0000</pubDate>
				<link>http://patg.net/haproxy,apache/2017/08/04/haproxy/</link>
				<guid isPermaLink="true">http://patg.net/haproxy,apache/2017/08/04/haproxy/</guid>
			</item>
		
			<item>
				<title>AMI creation - what is your process?</title>
				<description>&lt;h2 id=&quot;what-is-your-process-for-creating-amis&quot;&gt;What is your process for creating AMIs?&lt;/h2&gt;

&lt;p&gt;I’ve had a discussion with a colleague about the process of creating AMIs, or more specifically, dealing with instances that need some sort of state captured. AWS offers you the ability to create an image off of an instance. We were pondering in our discussion how that can be possible with the situation of how can AWS ensure that the state of what is being made into an image is what you expect it to be? Open file handles, things in memory needing to be flushed to disk. Is this feature of EC2 something that should even be used for an authoritative state you expect your image to be?&lt;/p&gt;

&lt;p&gt;In our case, it was an instance that was on a host that had problems and needed to be moved off and the underlying host become unresponsive (according to AWS) and the instance couldn’t even be shut down.&lt;/p&gt;

&lt;p&gt;The basic way to go about it would be to build a new instance, provision it the way you want it (Ansible, Chef, manual configuration) and once complete, stop the instance, and make an image from that.&lt;/p&gt;

&lt;p&gt;What is your process? And those of you intimate with the details of EC2, how fool-proof is the ‘create an image’ functionality?&lt;/p&gt;
</description>
				<pubDate>Mon, 24 Jul 2017 12:00:00 +0000</pubDate>
				<link>http://patg.net/aws,/ami,/images,/instances/2017/07/24/ami-creation/</link>
				<guid isPermaLink="true">http://patg.net/aws,/ami,/images,/instances/2017/07/24/ami-creation/</guid>
			</item>
		
			<item>
				<title>Percona Chart now in Kubernetes Charts</title>
				<description>&lt;h2 id=&quot;percona-helm-chart&quot;&gt;&lt;a href=&quot;https://github.com/kubernetes/charts/tree/master/stable/percona&quot;&gt;Percona Helm Chart&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;I’m happy to see that my pull request was approved. Pretty simply, it was a Percona Chart. We needed the setup at HPE for our cluster and it was a good excuse to put together a chart, so there ya go!&lt;/p&gt;

&lt;p&gt;To use it, simply run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;helm install --name my-release stable/percona&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-is-a-helm-chart&quot;&gt;What is a Helm chart?&lt;/h2&gt;

&lt;p&gt;Well, for those that don’t know, some prerequisite questions:&lt;/p&gt;

&lt;h3 id=&quot;what-is-helm&quot;&gt;What is &lt;a href=&quot;https://github.com/kubernetes/helm&quot;&gt;Helm&lt;/a&gt;?&lt;/h3&gt;

&lt;p&gt;Helm is a package manager for Kubernetes, these packages called “&lt;a href=&quot;https://github.com/kubernetes/charts&quot;&gt;charts&lt;/a&gt;”&lt;/p&gt;

&lt;h3 id=&quot;what-is-kubernetes&quot;&gt;What is &lt;a href=&quot;https://github.com/kubernetes/kubernetes&quot;&gt;Kubernetes&lt;/a&gt;?&lt;/h3&gt;

&lt;p&gt;Kubernetes is an open-sourced system for managing containerized applications across multiple hosts&lt;/p&gt;

&lt;h3 id=&quot;what-are-containers&quot;&gt;What are containers?&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://www.redhat.com/en/containers&quot;&gt;Containers&lt;/a&gt; are concept of technology in an operating system that isolation such that you can package an application and ship it anywhere and have it run the same exact way.&lt;/p&gt;
</description>
				<pubDate>Sat, 15 Apr 2017 12:00:00 +0000</pubDate>
				<link>http://patg.net/percona,mysql,kubernetes,helm/2017/04/15/percona-chart/</link>
				<guid isPermaLink="true">http://patg.net/percona,mysql,kubernetes,helm/2017/04/15/percona-chart/</guid>
			</item>
		
			<item>
				<title>Pokémon GO scaling with Couchbase</title>
				<description>&lt;p&gt;Interesting article on how Pokémon GO is &lt;a href=&quot;http://blog.couchbase.com/2016/october/pokemon-go-scaling-profile-services-with-couchbase--nosql?mkt_tok=eyJpIjoiWlRneU9UZ3lOVGd4T1dVMiIsInQiOiJqSjB2cjdzZ3dqN05Pa1JLVVdicldHczdabEVRRHE1dWNwQjc1b1lvM3Rka3o2ckxsV29DbGZqWUtGajBaZEt5RUpMa3JqY1dIeGwyMXhnck1zeng0bDNcL01jZXlhVDlJU3hveEZMT0F1OTg9In0%3D&quot;&gt;scaling profile services with Couchbase &amp;amp; NoSQL&lt;/a&gt;&lt;/p&gt;

</description>
				<pubDate>Wed, 02 Nov 2016 12:00:00 +0000</pubDate>
				<link>http://patg.net/couchbase,nosql,pokemongo/2016/11/02/pokemon-go-couchbase/</link>
				<guid isPermaLink="true">http://patg.net/couchbase,nosql,pokemongo/2016/11/02/pokemon-go-couchbase/</guid>
			</item>
		
			<item>
				<title>Terraform setup repository for AWS</title>
				<description>&lt;p&gt;Just a quick post for a project I put together using Terraform to &lt;a href=&quot;https://github.com/CaptTofu/terraform-aws-setup&quot;&gt;build out ready-to-use networking on aws&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;what-it-does-in-a-nutshell&quot;&gt;What it does in a nutshell&lt;/h2&gt;

&lt;p&gt;This project basically builds out a VPC with 4 subnets (one public, three private) that is all ready to use to build out your AWS environment using &lt;a href=&quot;https://www.terraform.io/&quot;&gt;Terraform&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s really simple to use. You just need to edit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;variables.tf&lt;/code&gt; to suit your AWS account credentials as well as whatever else you want to adjust.&lt;/p&gt;

&lt;p&gt;Sanity check with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform plan&lt;/code&gt; and then launch with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;terraform apply&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That’s it!&lt;/p&gt;

&lt;p&gt;Add more hosts, run whatever you need. All the networking (routing, gateways, security groups, etc) is ready to use.&lt;/p&gt;
</description>
				<pubDate>Wed, 21 Sep 2016 12:00:00 +0000</pubDate>
				<link>http://patg.net/terraform,aws/2016/09/21/terraform-aws/</link>
				<guid isPermaLink="true">http://patg.net/terraform,aws/2016/09/21/terraform-aws/</guid>
			</item>
		
			<item>
				<title>Running Kubernetes with Fleet on CoreOS</title>
				<description>&lt;p&gt;I’m pleased to announce publicly available Fleet Unit Files for launching a multi-node Kubernetes cluster on CoreOS, &lt;a href=&quot;https://github.com/CaptTofu/kubernetes-cluster-fleet&quot;&gt;kubernetes-cluster-fleet&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;

&lt;p&gt;I have run &lt;a href=&quot;https://github.com/GoogleCloudPlatform/kubernetes&quot;&gt;Kubernetes&lt;/a&gt; in any number of ways, particularly using Ansible to set it up,  but was recently wanting to see if it was possible to run Kubernetes completely using Fleet unit files on CoreoS– across multiple machines, something I haven’t found a solution for thus far other than some unit files that run Kubernetes on a single-machine. After a lot of trial and error and bash duct tape, it is indeed possible, hence my repository &lt;a href=&quot;https://github.com/CaptTofu/kubernetes-cluster-fleet&quot;&gt;https://github.com/CaptTofu/kubernetes-cluster-fleet&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;basic-idea&quot;&gt;Basic idea&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;When one runs Kubernetes, the API server is run, and it has in etcd an entry for the IP address it’s running on found in the entry &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/registry/services/endpoints/default/kubernetes&lt;/code&gt;. The unit files for every other Kubernetes component use this entry to set the value of what the API server ought to be.&lt;/li&gt;
  &lt;li&gt;There are also unit files that set up the environment and set the host/IP entries in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt; of every server to make it easier to deploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;

&lt;p&gt;Review the fine documentation on the project page for how to run this! It is pretty simple and straightforward.&lt;/p&gt;

</description>
				<pubDate>Tue, 12 Jul 2016 12:00:00 +0000</pubDate>
				<link>http://patg.net/kubernetes,coreos/2016/07/12/coreos-kubernetes/</link>
				<guid isPermaLink="true">http://patg.net/kubernetes,coreos/2016/07/12/coreos-kubernetes/</guid>
			</item>
		
	</channel>
</rss>
