I Use This!
Moderate Activity

News

Analyzed about 19 hours ago. based on code collected 1 day ago.
Posted over 1 year ago by Brad
This is another golang tutorial for beginners, I am creating a simple MVC application using the Echo framework and Mysql Database. MVC stands for the model view and controller pattern. We will create models and handlers in a separate file, that help ... [More] to easy and fast development for a big project. I have already shared […] The post Simple MVC Example Using Golang Echo and MySQL appeared first on GolangLearn. [Less]
Posted over 1 year ago by Brad
This golang tutorial help to understand the go string package. This tutorial applies some manipulation and modify string using go string. The Package strings implement simple functions to manipulate UTF-8 encoded strings. We will import ‘string’ ... [More] package for string manipulation. We will here discuss some common string operations using Go. Let’s start example of string […] The post Some Common String Problems & Solution of Golang appeared first on GolangLearn. [Less]
Posted over 1 year ago by Brad
This tutorial help to consume third-party HTTP post API using Golang in JSON format. There are a lot of products and tools available that provide access to his functionality using rest API. The Rest API could be GET/POST/PUT or Delete type, these are ... [More] HTTP methods to access the rest API. We will use HTTP post […] The post How To Consume Post Rest API Using Golang with JSON appeared first on GolangLearn. [Less]
Posted over 1 year ago by Brad
This tutorial help to implement an in-memory cache system into golang application. I am creating a full-stack application, The front-end will use rest API to get and set data into the cache. I am just sharing my thoughts to handle go-cache ... [More] implementation. I am storing struct type data and, that holds an array of object […] The post How To Set and Get Cache Using Golang Rest Api appeared first on GolangLearn. [Less]
Posted over 1 year ago by Brad
This tutorial help to implement in-memory cache system into golang application.I am creating full-stack application, The front-end will use rest api to get and set data into cache.I am just sharing my thoughts to handle go-cache implementation. I am ... [More] storing struct type data and, that hold array of object data.You can also use single data […] The post How To Set and Get Cache Using Golang Rest Api appeared first on GolangLearn. [Less]
Posted almost 2 years ago by Brad
in this tutorial, we’ll cover learn how to string replace in golang.The strings.Replace() function is an inbuilt function in golang for replacing a substring with a string. I have already shared tutorial about that Golang Regex Replace Example. The ... [More] strings.Replace() function returns a copy of the provided string with the first n non-overlapping instances of […] The post String Replace Golang with Example appeared first on GolangLearn. [Less]
Posted almost 2 years ago by Brad
dig Library is a mobile library. Provide injection of dependencies (dependency injection) The toolbox should be built around the reflection. It has been realized. It helps to resolve the object graph during process startup. Many items will be engaged ... [More] in the project, and their interdependencies may look like this. pckg1-->pckg2;pckg1-->pckg3;pckg2-->pckg4;pckg3-->pckg4; pckg4 is an item. The […] The post Golang dig – A better way to Manage Dependency appeared first on GolangLearn. [Less]
Posted about 2 years ago by MySQL Performance Blog
KMIP (Key Management Interoperability Protocol) is an open standard developed by OASIS (Organization for Advancement of Structured Information Standards) for the encryption of stored data and cryptographic key management. Percona Server for MySQL ... [More] 8.0.27 and Percona XtraBackup 8.0.27 now include a KMIP keyring plugin to enable the exchange of cryptographic keys between a key management server and the database for encryption purposes. The procedure to use them with HashiCorp Vault Enterprise is described below. Install Hashicorp Vault Enterprise We will first install Hashicorp Vault Enterprise on Ubuntu Linux “Bionic” and then enable the KMIP secrets engine. The KMIP secrets engine is only available with the Enterprise version of HashiCorp Vault, hence a valid license for it is required. Add HashiCorp repository and install enterprise vault package:curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" sudo apt-get update && sudo apt-get install vault-enterpriseExport the license as an environment variable:export VAULT_LICENSE=XXXXCreate a configuration file to be used with the vault, vault_config.hcl:disable_mlock = true default_lease_ttl = "24h" max_lease_ttl = "24h" storage "file" {   path    = "/home/manish.chawla/vault/data" } listener "tcp" {   address     = "127.0.0.1:8200"   tls_cert_file = "/home/manish.chawla/test_mode/certificates/vault.crt"   tls_key_file = "/home/manish.chawla/test_mode/certificates/vault.key" }Note: Vault root certificates and key need to be created separately and are not covered here. Start vault server with the configuration file:vault server -config=$HOME/vault_config.hcl 2>&1 &Note: To configure and start the vault using systemd, refer to the instructions here. Initialize the vault:vault operator init -address=https://127.0.0.1:8200This will generate five unseal keys and the initial root token.Unseal Key 1: rf4C6gY87tN0UkJbJY96Aq4+Zext1YqgwaDnm+0gBBAH Unseal Key 2: f9KA7EdlF391cIUzDqaS1N21JjML/36sZFl1x/OfCPn4 Unseal Key 3: 8Nh3EFYF7S0S9qqzdUIilPPRZRmWaDG+3El4rr4FmZNX Unseal Key 4: iJaCKBIzxulLvA/6vbF3fRK1RXVZ0zLEZoVdlv/s13Sc Unseal Key 5: rA4pwT6EZLwmVXPQJfU9fjgeGwPaHl260qM9CVNiUw13 Initial Root Token: s.WXEZ26Yb3MtvzbvNMMIG8bveUnseal the vault. Use any three unseal keys to unseal the vault. Three keys are required to unseal the vault.vault operator unseal -address=https://127.0.0.1:8200 rf4C6gY87tN0UkJbJY96Aq4+Zext1YqgwaDnm+0gBBAH Key                Value ---                ----- Seal Type          shamir Initialized        true Sealed             true Total Shares       5 Threshold          3 Unseal Progress    1/3 Unseal Nonce       aa1a25c8-aa90-49b3-b127-875524de38f8 Version            1.9.3+ent Storage Type       file HA Enabled         false vault operator unseal -address=https://127.0.0.1:8200 f9KA7EdlF391cIUzDqaS1N21JjML/36sZFl1x/OfCPn4 Key                Value ---                ----- Seal Type          shamir Initialized        true Sealed             true Total Shares       5 Threshold          3 Unseal Progress    2/3 Unseal Nonce       aa1a25c8-aa90-49b3-b127-875524de38f8 Version            1.9.3+ent Storage Type       file HA Enabled         false vault operator unseal -address=https://127.0.0.1:8200 8Nh3EFYF7S0S9qqzdUIilPPRZRmWaDG+3El4rr4FmZNX Key             Value ---             ----- Seal Type       shamir Initialized     true Sealed          false Total Shares    5 Threshold       3 Version         1.9.3+ent Storage Type    file Cluster Name    vault-cluster-7d9b43de Cluster ID      c047dcb5-5038-5a29-f4af-47c1ad560f9c HA Enabled      falseThe vault is unsealed. To use the vault in any terminal, run:export VAULT_ADDR=https://127.0.0.1:8200 export VAULT_TOKEN=s.WXEZ26Yb3MtvzbvNMMIG8bve export VAULT_CACERT=/home/manish.chawla/test_mode/certificates/root.cer Configure KMIP Secrets Engine in Vault Enable KMIP secrets engine:vault secrets enable kmip Success! Enabled the kmip secrets engine at: kmip/View the secrets list:vault secrets list Path          Type         Accessor              Description ----          ----         --------              ----------- cubbyhole/    cubbyhole    cubbyhole_ec12856f    per-token private secret storage identity/     identity     identity_12d9670d     identity store kmip/         kmip         kmip_5fb3d4c6         n/a sys/          system       system_1733eece       system endpoints used for control, policy and debuggingChange the kmip server listening address and port:vault write kmip/config listen_addrs=0.0.0.0:5696 Success! Data written to: kmip/configNote: Here kmip is the default path of the secret engine and not the type of the engine. By default, the kmip generates certificates in EC(Elliptic Curve). We need RSA for MySQL, so specify the certificate type (tls_ca_key_type) and bits (tls_ca_key_bits) to configure the kmip server.vault write kmip/config tls_ca_key_type="rsa" tls_ca_key_bits=2048 Success! Data written to: kmip/configvault read kmip/config Key                            Value ---                            ----- default_tls_client_key_bits    256 default_tls_client_key_type    ec default_tls_client_ttl         336h listen_addrs                   [0.0.0.0:5696] server_hostnames               [localhost] server_ips                     [127.0.0.1 ::1] tls_ca_key_bits                2048 tls_ca_key_type                rsa tls_min_version                tls12The KMIP secrets engine uses scopes to partition object storage into multiple named buckets. Within a scope, roles can be created with a set of allowed operations that the particular role can perform. Create a scope:vault write -f kmip/scope/my-service Success! Data written to: kmip/scope/my-serviceCreate a role within the scope, specifying the set of operations to allow or deny.vault write kmip/scope/my-service/role/admin operation_all=true Success! Data written to: kmip/scope/my-service/role/adminClient Certificate Generation for the scope and role created above. Retrieve the generated CA certificate:vault read kmip/caCopy and save the CA certificate as ca.pem. Generate a certificate in PEM format, and save it in a JSON file named credential.json.vault write -format=json \     kmip/scope/my-service/role/admin/credential/generate \     format=pem > credential.jsonExtract the certificate from the credential.json using jq tool and save it in a file named cert.pem.jq -r .data.certificate < credential.json > cert.pemExtract the private key from the credential.json using jq tool and save it in a file named key.pem.jq -r .data.private_key < credential.json > key.pemThe KMIP configuration is now complete. Percona Server for MySQL 8.0.27 Configuration for KMIP This section describes the KMIP configuration in Percona Server for MySQL. KMIP is configured as a component in Percona Server for MySQL. Create the global manifest file(mysqld.my) in the mysqld installation directory.{   "components": "file://component_keyring_kmip" }Create the global configuration file, component_keyring_kmip.cnf in the directory, where the component_keyring_kmip library resides.{ "path": "/home/manish.chawla/keyring_kmip", "server_addr": "0.0.0.0", "server_port": "5696", "client_ca": "/home/manish.chawla/cert.pem", "client_key": "/home/manish.chawla/key.pem", "server_ca": "/home/manish.chawla/ca.pem" }Note: SElinux/AppArmor rules may have to be adjusted, so that Percona Server for MySQL and Percona XtraBackup can access the certificates. Initialize and start mysqld with encryption options(add in my.cnf): --innodb-undo-log-encrypt --innodb-redo-log-encrypt --binlog-encryption --default-table-encryption=ON --log-replica-updates --gtid-mode=ON --enforce-gtid-consistency --binlog-format=row --source-verify-checksum=ON --binlog-checksum=CRC32 --table-encryption-privilege-check=ONCheck the KMIP component status:8.0.27>SELECT * FROM performance_schema.keyring_component_status; +---------------------+------------------------------+ | STATUS_KEY | STATUS_VALUE | +---------------------+------------------------------+ | Component_name | component_keyring_kmip | | Author | Percona Corporation | | License | GPL | | Implementation_name | component_keyring_kmip | | Version | 1.0 | | Component_status | Active | | Server_addr | 0.0.0.0 | | Server_port | 5696 | | Client_ca | /home/manish.chawla/cert.pem | | Client_key | /home/manish.chawla/key.pem | | Server_ca | /home/manish.chawla/ca.pem | | Object_group | | +---------------------+------------------------------+Create some encrypted tables and add data in the Percona Server for MySQL. Backup and Restore of Percona Server for MySQL 8.0.27 Using Percona XtraBackup 8.0.27 This section describes the procedure for taking backup and restore of Percona Server for MySQL 8.0.27 when the KMIP component is enabled and the KMIP vault server is running. Percona XtraBackup reads the KMIP configuration in Percona Server for MySQL automatically, and it is not required to pass this information separately. Take full backup:xtrabackup --user=backup --password=* --backup --target-dir=backup_directoryPrepare full backup:xtrabackup --prepare --target_dir=backup_directoryStop Percona Server for MySQL and move the data directory to another location. Disable SElinux/AppArmor before restoring the backup. Restore full backup:xtrabackup --copy-back --target-dir=backup_directoryChange the ownership of the copied files in the Percona Server for MySQL data directory to the MySQL user. Start Percona Server for MySQL and check the data. Enable SElinux/AppArmor, if disabled previously. [Less]
Posted about 2 years ago by Joshua Otwell
Being mindful of NULL values is a good practice. NULLs can slip up on you and give you a heck of a time (especially in calculations) if you aren’t careful. In this post, we will see examples of NULLtransformation with the MySQL COALESCE() function. ... [More] Do you need to learn MySQL? Just starting and confused about how to query a table and get the data you need? I am creating premium MySQL Beginners content for this specific reason. To help those who want to learn the basics of MySQL but don’t know where to start. Learn more about the premium blog posts as I develop and release them. Tell me more! Image by Gerd Altmann from Pixabay  The Newsletter for PHP and MySQL Developers MySQL COALESCE() function accepts multiple arguments and returns the first non-NULL value. If there aren’t any non-NULLs, the COALESCE() returns NULL. Get tailored articles with Refind delivered each day in your inbox. Refind is part of my daily reading habit. Make it part of yours by using my referral link. At no additional cost to you, I will be eligible for a premium subscription with more sign-ups from my link. “The essence of the web, every morning in your inbox. Subscribe for free“ Read the entire post, Transform NULL values with the MySQL COALESCE function to learn how to substitute NULL values for something more meaningful in query results. Self-Promotion: If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like! Show your support for my blog and content by tossing any spare change you have in my Tip Jar. Tip Jar Are you a Medium member? If so, receive an email notification each time I publish a blog post if you prefer the Medium platform. Not a member? No worries! Use my sign-up link (I will get a commission at no extra cost to you) and join. I really enjoy reading all the great content there and I know you will too!!! Similar reading If you enjoyed this article, you may also like any of these posts. Share them along as well. Thank you MySQL IFNULL()SUBSTRING_INDEX()Recursive CTE Fun in MySQLMySQL SHOW TABLESLearn about my personal backend web developer journey where I share much of my goals and commitment to learning to code. Read this interview. Like what you have read? See anything incorrect? Please comment below and thank you for reading!!! A Call To Action! Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well. Visit the Portfolio-Projects page to see blog posts/technical writing I have completed for clients. To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the ‘Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…) Be sure and visit the “Best Of” page for a collection of my best blog posts. Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters. Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own. How can I help you? Are you thinking of starting up a blog? I use WordPress for my blog. Let’s both save money on the plans offered. Grab a Gmail HTML Email Signature template from my Etsy shop and make your emails pop and stand out. Need hosting for your next web application or WordPress site? I use and highly recommend Hostinger. They have great pricing and service.I enjoy reading Refind: The essence of the web, every morning in your inbox. Subscribe for free. Help me get a premium subscription by signing up yourself with my referral link.Grab a free pack of mobile Creator wallpapers.Just getting started or wanting to learn MySQL? Find out about my premium blog posts and MySQL Beginner Series here.The Newsletter for PHP and MySQL Developers Disclosure: Some of the services and products links in this post are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission. The post MySQL NULL value transformation with COALESCE() – Medium repost appeared first on Digital Owl's Prose. [Less]
Posted about 2 years ago by Jean-François Gagné
When Index Condition Pushdown is used, you cannot trust rows examined as reported by the slow query log (nor in some Performance Schema tables) and you cannot trust the global status Innodb_rows_read (nor the InnoDB Metrics dml_reads).  These can ... [More] lead to an incorrect query complexity analysis, to a mistaken estimation of the total load of a MySQL server, and to a lot of wasted time.  As we go [Less]