Houston  Sipes

Houston Sipes

1602315617

Deploying a go application and a redis cluster in minikube

In my previous post, I wrote a go application that displays the GPS location of any IP address. Here in this post, I’ll explain how to deploy the same in minikube.

Prerequisites

  • understanding of kubernetes components (pods, deployment, etc.)
  • minikube installed in your laptop

Kubernetes tutorial

If you are new to kubernetes and want to learn, I recommend this youtube playlist.

Minikube

Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.

_if you don’t have minikube installed in your laptop, you can do it by following the instructions _here.

Desired Deployment State

  • 2 instances of our web application.
  • **a load balancer **that balances the load on our two web application instances.
  • a redis cluster with a master-slave replication.

Image for post

Image for post

desired deployment state

I’m going to list down 7 steps I did to get to the above shown desired state. I hope you can replicate what I did very easily in your own minikube environment.

Step 1: start minikube

minikube start

you should receive an output like this

MacBook-Pro-2:Desktop jeshocarmel$ minikube start
😄  minikube v1.12.3 on Darwin 10.14.3
✨  Using the hyperkit driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🏃  Updating the running hyperkit "minikube" VM ...
🐳  Preparing Kubernetes v1.18.3 on Docker 19.03.12 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
🏄  Done! kubectl is now configured to use "minikube"

To ensure minikube has started successfully, run the command below

minikube status

and you should receive an output like this.

#kubernetes #redis #golang #containers #minikube

What is GEEK

Buddha Community

Deploying a go application and a redis cluster in minikube
Loma  Baumbach

Loma Baumbach

1596679140

Redis Transactions & Long-Running Lua Scripts

Redis offers two mechanisms for handling transactions – MULTI/EXEC based transactions and Lua scripts evaluation. Redis Lua scripting is the recommended approach and is fairly popular in usage.

Our Redis™ customers who have Lua scripts deployed often report this error – “BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE”. In this post, we will explain the Redis transactional property of scripts, what this error is about, and why we must be extra careful about it on Sentinel-managed systems that can failover.

Redis Lua Scripts Diagram - ScaleGrid Blog

Transactional Nature of Redis Lua Scripts

Redis “transactions” aren’t really transactions as understood conventionally – in case of errors, there is no rollback of writes made by the script.

Atomicity” of Redis scripts is guaranteed in the following manner:

  • Once a script begins executing, all other commands/scripts are blocked until the script completes. So, other clients either see the changes made by the script or they don’t. This is because they can only execute either before the script or after the script.
  • However, Redis doesn’t do rollbacks, so on an error within a script, any changes already made by the script will be retained and future commands/scripts will see those partial changes.
  • Since all other clients are blocked while the script executes, it is critical that the script is well-behaved and finishes in time.

The ‘lua-time-limit’ Value

It is highly recommended that the script complete within a time limit. Redis enforces this in a weak manner with the ‘lua-time-limit’ value. This is the maximum allowed time (in ms) that the script is allowed to run. The default value is 5 seconds. This is a really long time for CPU-bound activity (scripts have limited access and can’t run commands that access the disk).

However, the script is not killed when it executes beyond this time. Redis starts accepting client commands again, but responds to them with a BUSY error.

If you must kill the script at this point, there are two options available:

  • SCRIPT KILL command can be used to stop a script that hasn’t yet done any writes.
  • If the script has already performed writes to the server and must still be killed, use the SHUTDOWN NOSAVE to shutdown the server completely.

It is usually better to just wait for the script to complete its operation. The complete information on methods to kill the script execution and related behavior are available in the documentation.

#cloud #database #developer #high availability #howto #redis #scalegrid #lua-time-limit #redis diagram #redis master #redis scripts #redis sentinel #redis servers #redis transactions #sentinel-managed #server failures

Houston  Sipes

Houston Sipes

1602315617

Deploying a go application and a redis cluster in minikube

In my previous post, I wrote a go application that displays the GPS location of any IP address. Here in this post, I’ll explain how to deploy the same in minikube.

Prerequisites

  • understanding of kubernetes components (pods, deployment, etc.)
  • minikube installed in your laptop

Kubernetes tutorial

If you are new to kubernetes and want to learn, I recommend this youtube playlist.

Minikube

Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.

_if you don’t have minikube installed in your laptop, you can do it by following the instructions _here.

Desired Deployment State

  • 2 instances of our web application.
  • **a load balancer **that balances the load on our two web application instances.
  • a redis cluster with a master-slave replication.

Image for post

Image for post

desired deployment state

I’m going to list down 7 steps I did to get to the above shown desired state. I hope you can replicate what I did very easily in your own minikube environment.

Step 1: start minikube

minikube start

you should receive an output like this

MacBook-Pro-2:Desktop jeshocarmel$ minikube start
😄  minikube v1.12.3 on Darwin 10.14.3
✨  Using the hyperkit driver based on existing profile
👍  Starting control plane node minikube in cluster minikube
🏃  Updating the running hyperkit "minikube" VM ...
🐳  Preparing Kubernetes v1.18.3 on Docker 19.03.12 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
🏄  Done! kubectl is now configured to use "minikube"

To ensure minikube has started successfully, run the command below

minikube status

and you should receive an output like this.

#kubernetes #redis #golang #containers #minikube

Fannie  Zemlak

Fannie Zemlak

1599854400

What's new in the go 1.15

Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.

As Go promise for maintaining backward compatibility. After upgrading to the latest Go 1.15 version, almost all existing Golang applications or programs continue to compile and run as older Golang version.

#go #golang #go 1.15 #go features #go improvement #go package #go new features

Aida  Stamm

Aida Stamm

1590207561

How to Deploy a Resilient Go Application to Kubernetes on DigitalOcean

How to Deploy a Resilient Go Application to Kubernetes on DigitalOcean

Subscribe to the channel https://www.youtube.com/watch?v=g_-U5jddSuM

#deploy #application #go #kubernetes #digitalocean

Using 'Go Generate' To Deploy Multi-Process Apps

In microservice architectures, it is fairly common to have a project that includes different worker types. A Makefile can be used to manage the creation of multiple programs, but the Go toolchain has a great tool that can be used as well, go generate. Here are some examples of how we take advantage of ‘go generate’ at Nuvi:

  • API/Worker – We have an API that allows clients to start/stop long-running jobs, and a worker which accesses the same database to run the jobs.
  • NLP Classifier – We have different processes that share a majority of the same code, but have different quirks depending on if they are classifying sentiment, vulgarity, or subjectivity.

In other words, we have one git repository, but from that code, we want to generate ‘n‘ number of executables.

#golang #programming #tutorial #ci/cd #deployment #go #go generate #toolchain