quarta-feira, 30 de novembro de 2022

[Mongo DB] - Basic sort and read operations (or "R" from CRUD)

Hello all

In the last post (here), I have talked about create operations and running inserts, or the "C" from CRUD.

Today, I'm going to talk about executing read operations in Mongo DB, the "R" in CRUD. I'll talk about sort, as well.

But remember, I'm talking about basic operations. As we know, the Mongo DB world is much bigger than this post.  

Let's get started!!!

The references are here and here.

-- List all
db.movies.find()


-- Find the first row matching the object
db.movies.findOne({trilogy: "Transformers"})


-- Limit the number of rows
db.movies.find().limit(3)


-- Count the number of rows
db.movies.find().count()


-- Where trilogy="Transformers"
db.movies.find( {trilogy: "Harry Potter"} )


-- List fields _id, codigo, sequence, year
db.movies.find( {trilogy: "Transformers"}, { codigo: 1, sequence: 1, year: 1 })


-- List fields withouth id
db.movies.find( {trilogy: "Transformers"}, { _id: 0, codigo: 1, sequence: 1, year: 1 })


-- Concat Trilogy - Sequence
db.movies.find({trilogy: "Transformers"},{ _id: 0, codigo: 1, year: 1, name: {$concat: ["$trilogy"," - ","$sequence"]} })


-- List rows with codigo are between 5 and 12
db.movies.find({ codigo: { $gt: 5, $lt: 12 } },{ _id: 0, codigo: 1, year: 1, name: {$concat: ["$trilogy"," - ","$sequence"]} })


-- List rows with codigo are between 5 and 12 and Trilogy="Transformers"
db.movies.find({ codigo: { $gt: 5, $lt: 12 }, trilogy: "Transformers"},{ _id: 0, codigo: 1, year: 1, name: {$concat: ["$trilogy"," - ","$sequence"]} })


-- List rows with codigo are between 5 and 12 and Sort - Year Desc, Name Asc
db.movies.find({ codigo: { $gt: 5, $lt: 12 } },{ _id: 0, codigo: 1, year: 1, name: {$concat: ["$trilogy"," - ","$sequence"]} }).sort({"year": -1, "name": 1 })


That's all folks!!!

Yes, the reading operations are easy!!! 

I hope that it helps you!!!

Regards
Mario 

quinta-feira, 24 de novembro de 2022

[MongoDB] - Logical Structures and basic create operations (or "C" from CRUD)

Hello all

Today, we talk about Logical Structures in MongoDB and how do you insert one or many register into a collection.

But first, we need to understand what a database is, a collection, a document and a field in MongoDB.

For example, one database can have many collections. A collection can have many documents, and documents can have fields. It's easy :) 

As the glossary definitions:

Database
A physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases.

Collection
A grouping of MongoDB documents. A collection is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection have a similar or related purpose. 

Document
A record in a MongoDB collection and the basic unit of data in MongoDB. Documents are analogous to JSON objects but exist in the database in a more type-rich format known as BSON.

Documents have the following restrictions on field names:
  • The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array. If the _id contains subfields, the subfield names cannot begin with a ($) symbol.
  • Field names cannot contain the null character.
  • The server permits storage of field names that contain dots (.) and dollar signs ($). MongoDB 5.0 adds improved support for the use of ($) and (.) in field names. There are some restrictions. 
Field
A name-value pair in a document. A document has zero or more fields. Fields are analogous to columns in relational databases. 

Ok, it's easy. Now, we'll create a new database, a new collection and insert the first documents on the collection. Of course, we'll list the documents.

View all databases
show dbs
show databases





Create new database or switch database 
use thordb

View current Database
db

Show all collections in database
show collections

Create collection call movies
db.createCollection('movies')

As soon as possible, we'll have a post just talking about Create Collections.









Insert a single row
db.movies.insertOne({codigo: 1, trilogy: "Harry Potter", sequence: "The Philosophers Stone", year: "2001"})







Insert many rows
db.movies.insertMany ([
{codigo: 2, trilogy: "Harry Potter", sequence: "Harry Potter and the Chamber of Secrets", year: "2002"},
{codigo: 3, trilogy: "Harry Potter", sequence: "Harry Potter and the Prisoner of Azkaban", year: "2004"},
{codigo: 4, trilogy: "Harry Potter", sequence: "Harry Potter and the Goblet of Fire", year: "2005"},
{codigo: 5, trilogy: "Harry Potter", sequence: "Harry Potter and the Order of the Phoenix", year: "2007"},
{codigo: 6, trilogy: "Transformers", sequence: "Transformers: Dark of the Moon", year: "2011"},
{codigo: 7, trilogy: "Transformers", sequence: "Transformers: Age of Extinction", year: "2014"},
{codigo: 8, trilogy: "Transformers", sequence: "Transformers: The Last Knight", year: "2017"},
{codigo: 9, trilogy: "Harry Potter", sequence: "Harry Potter and the Half-Blood Prince", year: "2009"},
{codigo: 10, trilogy: "Harry Potter", sequence: "Harry Potter and the Deathly Hallows P1", year: "2010"},
{codigo: 11, trilogy: "Transformers", sequence: "Transformers: Revenge of the Fallen", year: "2009"},
{codigo: 12, trilogy: "Harry Potter", sequence: "Harry Potter and the Deathly Hallows P2", year: "2011"},
{codigo: 13, trilogy: "Transformers", sequence: "Transformers", year: "2007"},
{codigo: 14, trilogy: "Transformers", sequence: "Bumblebee", year: "2018"},
{codigo: 15, trilogy: "Harry Potter", sequence: "Fantastic Beasts and Where to Find Them", year: "2016"}
])



















Show all rows in a collection 
db.movies.find()




























Yes baby, today you learned the basic about the "C" or "Create Operations" from CRUD in MongoDB.

That's it. As I said, it was easy. The basic always is easy!!!

On next posts, we'll learn about the "R" or "Read Operations" and we'll learn about array operations. 

I hope that it helps you.

Regards 
Mario

Previous articles:

quinta-feira, 17 de novembro de 2022

[MongoDB] - How to install?

Hello all

As you know, I have been studying new products, and I started to play with MongoDb. 


This is being fantastic journey at the moment. 

And I have thought, while I'm learning, I can share it with you, and we can learn together.

Today, we gonna install the MongoDB for tests.

Yes, it's the first installation and the real world may be different - and it's, probably, but this post may help people like me who need a push to take the first step into a new technology. 

But just remember:
1) This work for me, but it might not work for you.
2) It's a basic install. As we go along, we'll get better and better.
3) 
This post is just for study and tests as well and it has no concern for Best Practices, at this moment.
        4) On next posts, we'll think in Best Practices and Security.

All steps we find here:

Thank you, my friend Adriano Bonacin for the Yadax Blog. The blog is helping me a lot.

So, let's go to the party!!!

For my installation, I created an EC2 instance in Free Tier from AWS using CentOS.

1) Configure yum repo.

sudo vi /etc/yum.repos.d/mongodb-org-6.0.repo 
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc

sudo yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: download.cf.centos.org
* extras: download.cf.centos.org
* updates: download.cf.centos.org
repo id                          repo name                    status
base/7/x86_64              CentOS-7 - Base              10,072
extras/7/x86_64            CentOS-7 - Extras             515
mongodb-org-6.0/7       MongoDB Repository        55
updates/7/x86_64          CentOS-7 - Updates         4,385

2) Install mongodb-org

sudo yum install -y mongodb-org
    Installed:
    mongodb-org.x86_64 0:6.0.3-1.el7

    Dependency Installed:
    cyrus-sasl.x86_64 0:2.1.26-24.el7_9                            
    cyrus-sasl-gssapi.x86_64 0:2.1.26-24.el7_9
    cyrus-sasl-plain.x86_64 0:2.1.26-24.el7_9
    mongodb-database-tools.x86_64 0:100.6.1-1
    mongodb-mongosh.x86_64 0:1.6.0-1.el8
    mongodb-org-database.x86_64 0:6.0.3-1.el7
    mongodb-org-database-tools-extra.x86_64 0:6.0.3-1.el7
    mongodb-org-mongos.x86_64 0:6.0.3-1.el7             
    mongodb-org-server.x86_64 0:6.0.3-1.el7
    mongodb-org-tools.x86_64 0:6.0.3-1.el7
    Complete!

sudo yum install -y mongodb-org-6.0.2 mongodb-org-database-6.0.2 mongodb-org-server-6.0.2 mongodb-mongosh-6.0.2 mongodb-org-mongos-6.0.2 mongodb-org-tools-6.0.2
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: download.cf.centos.org
     * extras: download.cf.centos.org
     * updates: download.cf.centos.org
    Package matching mongodb-org-6.0.2-1.el7.x86_64 already installed. Checking for update.
    Package matching mongodb-org-database-6.0.2-1.el7.x86_64 already installed. Checking for update.
    Package matching mongodb-org-server-6.0.2-1.el7.x86_64 already installed. Checking for update.
    No package mongodb-mongosh-6.0.2 available.
    Package matching mongodb-org-mongos-6.0.2-1.el7.x86_64 already installed. Checking for update.
    Package matching mongodb-org-tools-6.0.2-1.el7.x86_64 already installed. Checking for update.
    Nothing to do

3) Today, we'll use the Default Directories
    /var/lib/mongo      (the data directory)
    /var/log/mongodb (the log directory)

The package manager creates the default directories during installation, and the the owner and group name as well. The user and group are mongod.

    id mongod
    uid=996(mongod) gid=994(mongod) groups=994(mongod)

4) Install the SElinux Policy
    
    sudo yum install git make checkpolicy policycoreutils selinux-policy-devel
        
        Installed:
git.x86_64 0:1.8.3.1-23.el7_8
        selinux-policy-devel.noarch 0:3.13.1-268.el7_9.2

Dependency Installed:
m4.x86_64 0:1.4.16-10.el7             
        perl.x86_64 4:5.16.3-299.el7_9               
        perl-Carp.noarch 0:1.26-244.el7         
        perl-Encode.x86_64 0:2.51-7.el7
        perl-Error.noarch 1:0.17020-2.el7
        perl-Exporter.noarch 0:5.68-3.el7
        perl-File-Path.noarch 0:2.09-2.el7
        perl-File-Temp.noarch 0:0.23.01-3.el7
        perl-Filter.x86_64 0:1.49-3.el7
        perl-Getopt-Long.noarch 0:2.40-3.el7
        perl-Git.noarch 0:1.8.3.1-23.el7_8
        perl-HTTP-Tiny.noarch 0:0.033-3.el7
        perl-PathTools.x86_64 0:3.40-5.el7
        perl-Pod-Escapes.noarch 1:1.04-299.el7_9
        perl-Pod-Perldoc.noarch 0:3.20-4.el7
        perl-Pod-Simple.noarch 1:3.28-4.el7
        perl-Pod-Usage.noarch 0:1.63-3.el7
        perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 
        perl-Socket.x86_64 0:2.010-5.el7
        perl-Storable.x86_64 0:2.45-3.el7
        perl-TermReadKey.x86_64 0:2.30-20.el7
        perl-Text-ParseWords.noarch 0:3.29-4.el7
        perl-Time-HiRes.x86_64 4:1.9725-3.el7
        perl-Time-Local.noarch 0:1.2300-2.el7
        perl-constant.noarch 0:1.27-2.el7
        perl-libs.x86_64 4:5.16.3-299.el7_9
        perl-macros.x86_64 4:5.16.3-299.el7_9
        perl-parent.noarch 1:0.225-244.el7
        perl-podlators.noarch 0:2.5.1-3.el7
        perl-threads.x86_64 0:1.87-4.el7
        perl-threads-shared.x86_64 0:1.43-6.el7
        policycoreutils-devel.x86_64 0:2.5-34.el7
        Complete!

sudo git clone https://github.com/mongodb/mongodb-selinux
Cloning into 'mongodb-selinux'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 45 (delta 17), reused 25 (delta 7), pack-reused 0
Unpacking objects: 100% (45/45), done.

cd mongodb-selinux
sudo make
(cd selinux; make -f /usr/share/selinux/devel/Makefile)
make[1]: Entering directory `/root/mongodb-selinux/selinux'
Compiling targeted mongodb module
/usr/bin/checkmodule:  loading policy configuration from tmp/mongodb.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 19) to tmp/mongodb.mod
Creating targeted mongodb.pp policy package
rm tmp/mongodb.mod tmp/mongodb.mod.fc
make[1]: Leaving directory `/root/mongodb-selinux/selinux'
mkdir -p build/targeted
mv selinux/mongodb.pp build/targeted/

sudo make install
cp build/targeted/mongodb.pp /usr/share/selinux/targeted/mongodb.pp
/usr/sbin/semodule --priority 200 --store targeted --install /usr/share/selinux/targeted/mongodb.pp
libsemanage.semanage_direct_install_info: Overriding mongodb module at lower priority 100 with module at priority 200.
/sbin/fixfiles -R mongodb-enterprise-server restore || true
Warning: Skipping the following R/O filesystems:
/sys/fs/cgroup
mongodb-enterprise-server not found
/sbin/fixfiles -R mongodb-org-server restore || true
Warning: Skipping the following R/O filesystems:
/sys/fs/cgroup
/sbin/restorecon -R /var/lib/mongo || true
/sbin/restorecon -R /run/mongodb || true

5) Start Mongo DB

    sudo systemctl start mongod

    sudo mongod --version
  

    sudo systemctl status mongod

6) Check the startup status
    systemctl is-enabled mongod; echo $?
        disabled
        0

    sudo systemctl enable mongod

You can follow important messages on logfile:
sudo tail -f /var/log/mongodb/mongod.log

7) And that's it, your MongoDb is installed.

Yes, I know that we need to do some configurations, but we'll make this on next post.

I hope that help you!!!

Regards
Mario

terça-feira, 1 de novembro de 2022

Oracle RAC - Install & Patch at the same time - From 19.3.0.0 to 19.17.0.0

Hello all

Yesterday, I was installing a new Oracle RAC 19c and I had an unusual error in the Oracle Base directory.

I was installing the base version of Grid, 19.3.0.0.

The error was this: 
INS-4400 - The Oracle Home location contains directories or files on following remote nodes.


I asked in the GUOB user group and after many checks, the solution was to apply the RU before installation. My friends Vini, Mufalani & Rodrigo Jorge helped me to check these points. Thanks.
This is the Step-by-Step:

1) Create a new GRID HOME
cd /u01/app
mkdir -p 19.17.0.0/grid
export GRID_HOME=/u01/app/19.17.0.0/grid
2) Update Opatch
Check & download Opatch last version (6880880)
cd $GRID_HOME
unzip /u01/INSTALL/opatch/p6880880_190000_LINUX.zip -o /u01/app/19.17.0.0/grid
3) Important (tip from Rodrigo Jorge 😎):



4) Applying the patch "GI RELEASE UPDATE 19.17.0.0.0 (System Patch)"
cd $GRID_HOME
unzip p34416665_190000_Linux-x86-64.zip
./gridSetup.sh -applyRU 34416665
Preparing the home to patch...
Applying the patch 34416665...
Successfully applied the patch.
The log can be found at: /tmp/GridSetupActions2022-10-31_04-51-49PM/installerPatchActions_2022-10-31_04-51-49PM.log

After that, it was easy to continue the installation.
I hope that help you.

Regards
Mario


sexta-feira, 14 de outubro de 2022

Oracle Database - Create an Oracle environment for tests with Swingbench

Hello all

Yesterday I needed to build a test environment with Power Protect using DD Boost.

When I have to building an environment for tests, I use Workbench to this.

Below, I put a step by step to build a simple environment.

For this test, I'm create the database IRONMAN with a PDB call IM1.

And just remember, it has worked for me, but it may not work for you.

=================================
== Download Swingbench
=================================
su - oracle 
mkdir Swingbench
cd Swingbench
wget https://www.dominicgiles.com/site_downloads/swingbenchlatest.zip
 
=================================
== Create a TNSNAMES
=================================
vim $ORACLE_HOME/network/admin/tnsnames.ora

IM1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.localdomain)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = im1)
)
)

=================================
== Restart TNSNAMES
=================================
        -- The script grid.sh create environment variables for grid infrastructure 
source grid.sh
srvctl stop listener
srvctl start listener
srvctl status listener -v

-- The script db.sh create environment variables for database IRONMAN 
source db.sql
sqlplus system/xxx@IM1
=================================
== Create tablespace and user
=================================
alter session set container=IM1;

-- Drop user & tablespace, if exists
DROP USER soe CASCADE;
DROP TABLESPACE SOE INCLUDING CONTENTS AND DATAFILES; 

-- Create a tablespace with Bigfile
CREATE BIGFILE TABLESPACE SOE DATAFILE '+DATA' SIZE 100G AUTOEXTEND ON NEXT 100G MAXSIZE 500G;

-- Create user
CREATE USER soe IDENTIFIED BY Dell123## DEFAULT TABLESPACE soe TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;
ALTER USER soe QUOTA UNLIMITED ON soe;
GRANT CREATE SESSION, DBA to soe; 

=================================
== Create REDOs and alter TEMP &
== UNDO, if necessary
=================================
-- Redos
column REDOLOG_FILE_NAME format a50;
set lines 1000
SELECT a.GROUP#, a.THREAD#, a.SEQUENCE#,
   a.ARCHIVED, a.STATUS, b.MEMBER AS REDOLOG_FILE_NAME,
   (a.BYTES/1024/1024) AS SIZE_MB 
FROM v$log a
JOIN v$logfile b ON a.Group#=b.Group#
ORDER BY a.GROUP#;

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 4 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 5 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 6 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 7 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 8 ('+REDO','+REDO') SIZE 1G;
ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 9 ('+REDO','+REDO') SIZE 1G;
-- Undo 
col T_NAME for a23
col FILE_NAME for a65
SELECT tablespace_name T_NAME,file_name, bytes/1024/1024 MB 
FROM dba_data_files 
WHERE tablespace_name =(SELECT UPPER(value) FROM v$parameter WHERE name = 'undo_tablespace') 
ORDER BY file_name;

--- CDB
SQL> alter database datafile '+DATA/IRONMAN/DATAFILE/undotbs1.258.1107594131' resize 1G;
SQL> alter database datafile '+DATA/IRONMAN/DATAFILE/undotbs1.258.1107594131' autoextend on next 1G maxsize 31G;
SQL> alter tablespace undotbs1 ADD DATAFILE '+DATA' size 1G autoextend on next 512M maxsize 31G;

-- Temp
set pages 999 lines 400
col FILE_NAME format a75
SELECT d.TABLESPACE_NAME, d.FILE_NAME, d.BYTES/1024/1024 SIZE_MB, d.AUTOEXTENSIBLE, d.MAXBYTES/1024/1024 MAXSIZE_MB, d.INCREMENT_BY*(v.BLOCK_SIZE/1024)/1024 INCREMENT_BY_MB
FROM dba_temp_files d, v$tempfile v
WHERE d.FILE_ID = v.FILE#
ORDER BY d.TABLESPACE_NAME, d.FILE_NAME;
--- CDB
SQL> ALTER TABLESPACE temp ADD TEMPFILE '+DATA' SIZE 1G AUTOEXTEND ON NEXT 1G MAXSIZE 31G;
=================================
== Connection test
=================================
conn soe/xxx##@IM1

==================================================================
== Using Swingbench
==================================================================
First, disable archive mode to make the process faster.

cd /home/oracle/Swingbench/swingbench/bin
./shwizard










That's all folks!!!

I hope that help you.

Regards
Mario

terça-feira, 11 de outubro de 2022

Cloud Engineering & Architecture - Landing Zone

===================
EN
===================
Hello all

In my last MBA Cloud Engineering & Architecture class, we have had a discuss about Landing Zones and your importance in the Journey 2 Cloud process.

We have been talking about the Gartner’s Cloud Adoption Framework also.


One of many challenges for customer to Journey 2 Cloud is the moment of start of provisioning and deployment. It's between the step 4 and step 5 on the Framework.

At this moment we have many challenges of architecture, security & deployment problems to solve and many customers & Cloud Engineers make mistakes. They don't think in a pre-architecture and best practices for a Cloud environment because they have many tasks to do, many setups to plan and little time. 

One of many errors is to start the provisioning & deployment without Landing Zone.

Use the Landing Zone definitions can be helping to simplify and ensure the necessary security for the start of your project.
 
What is Landing Zone?

Landing Zone are a solution that helps the customers to create and configure a Secure Cloud Environment with many accounts where them can operate efficiently based on best practices for a Cloud Architecture to security, network, compartments, gateways, among others.

As we have many options of design, services & deploy options, the environment settings with many accounts can use much time and require a big knowledge about Cloud, besides being able to have many security issues.
 
For example, it's very important think in Tenancy, Policies, 2factor authentication, Compartments, Virtual Cloud Network (VCN) and subnets, Internet & NAT gateway, security groups, Firewall, DDoS, WAF, Infrastructure As A Code, notifications, automation, among other things. 

The Landing Zone Services can help you in these tasks.

Below, the links with the Landing Zone Rules & definitions in the Big Four Cloud Providers:

But just remember:
1) This work for me, but it might not work for you.
2) This post is just for study. The real world can be different - and it is, probably.

Regards
Mario

===================
PTB
===================
Fala pessoal

Em minha última aula do MBA Cloud Engineering & Architecture, nós falamos sobre Landing Zones e sua importância para o processo de Journey 2 Cloud.

Nós estamos falando também sobre o Gartner’s Cloud Adoption Framework.

Um dos muitos desafios para o cliente no Journey 2 Cloud é o momento de começar o provisionamento e o deployment. Isso fica entre o step 4 e o step 5 no Framework.

Neste momento nós temos muitos desafios com a arquitetura, segurança e problemas de deploy para rersolver e muitos clientes e Cloud Engineers cometem erros. Eles não pensam na pre-arquitetura e nas best practices para ambientes em Cloud porque eles tem muitas tarefas a fazer, muitos deploys a planejar, e pouco tempo para isso

Um dos muitos erros é começão o provisionamento e deployment sem usar Landing Zone.

Usar as definições de Landing Zone pode ajudar a simplificar e garantir a segurança necessária para o início do seu projeto.

O que é Landing Zone?

Landing Zone é uma solução que ajuda os clientes a criar e configurar um Ambiente Cloud Seguro com muitas contas onde eles podem operar de forma eficiente com base nas best practices de uma Arquitetura Cloud para segurança, network, compartiments, gateways, entre outros.

Como temos muitas opções de design, serviços e opções de implantação, as configurações do ambiente com muitas contas podem consumir muito tempo e exigir um grande conhecimento sobre Cloud, além de poder ter muitas falhas de segurança.
 
Por exemplo, é muito importante pensar em 
Tenancy, Policies, 2factor authentication, Compartments, Virtual Cloud Network (VCN) and subnets, Internet & NAT gateway, security groups, Firewall, DDoS, WAF, Infrastructure As A Code, notifications, automation, entre outras coisas.

Os Serviços da Landing Zone podem ajudá-lo nessas tarefas.

Acima, os links com as regras e definições da Landing Zone nos quatro grandes Cloud Providers.

Mas lembre-se:
1) Isso funciona para mim, mas pode não funcionar para você.
2) Esse post é apenas para aprendizado. O mundo real pode ser diferente - e provavelmente é.

Abraço
Mario

segunda-feira, 10 de outubro de 2022

OCI Foundations - Regions, Availability Domains & Fault Domains

==============
EN
==============
Hello All

I started my studies today to renew my OCI Foundations certification and as I study, I create my Mind Maps.

Today we will talk about Regions, Availability Domains and Fault Domains.

If you want to see the Mind Map, click on the image below.

Hope this helps you.

Regards
Mario


==============
PTB
==============
Fala pessoal

Eu comecei os meus estudos para renovar a minha certificação OCI Foundations hoje e conforme eu for estudando, eu vou criando meus Mind Maps.

Hoje vamos falar sobre Regions, Availability Domains & Fault Domains.

Se quiser ver o Mind Map, basta clicar na imagem abaixo.

Espero que isso ajude você.

Abraço
Mario



segunda-feira, 3 de outubro de 2022

Cloud Engineering & Architecture - Mental Map - API definitions and its main details (Definicções e principais detalhes de APIs)

====================
EN
====================
Hello all

One more Mental Map. 

This time, we'll talk about APIs, your definitions and its main details.

This subject have presented on API Management class on my MBA Cloud Engineering & Architecture. 

But just remember:
1) This work for me, but it migth not work for you.
2) This mental map is just for academic study. The real world can be different - and it is, probably.

If you want to see this API Mental Map, just click the image below. 

And if you have any question or suggestions,  let me know, please.

====================
PTB
====================
Fala pessoal

Mais um Mental Map. 

Dessa vez, vamos falar sobre APIs, suas definições e seus principais detalhes.

Esse assunto foi apresentado na aula de API Management no meu MBA de Cloud Engineering & Architecture. 

Mas lembre-se:
1)  Isso funciona para mim, mas pode não funcionar para você.
2) Esse Mental Map é apenas para aprendizado acadêmico. O mundo real pode ser diferente - e provavelmente é.

Se quiser ver o API Mental Map, basta clicar na imagem abaixo.

E se você tiver qualquer dúvida ou sugestão, por favor me fale.

Regards
Mario

quinta-feira, 29 de setembro de 2022

Cloud Engineering & Architecture - Install Docker-compose & Kong for API Management (Instalando o Docker-compose e o Kong para gerenciamento de APIs)

====================
EN
====================
Hello all...
 
Yesterday for my MBA API Management class, I have needed use the Docker and Kong for a Hands-On.

If you don't know, the Kong is a API Gateway and it's one of many Open Source tools for API management.

We have had a Hands-On using Konga that it's an administration UI fot Kong API Gateway. On Konga, we have defined the API source, routes and everything that we needed for call 3 simples APIs.

For this, I have configured an EC2 Instance running Red Hat 8 on AWS Free Tier.

The step-by-step to Docker-compose and Kong installation are bellow, if it helps.

But remember:
1) This worked for me, but might not work for you.
2) This installation is just for academic learn. The real world can be a little bit different.

===================
PTB
===================
Fala pessoal, beleza?

Ontem para uma das aulas de Grenciamento de APIs do MBA, precisei subir o Docker e o Kong para um dos Hands-on.

Para quem não conhece, o Kong é um Gateway API e é uma das várias ferramentas para gerenciamento de APIs open source disponíveis no mercado.

Fizemos o Hands-on através do Konga que é uma UI para administrar o Kong API Gateway. Lá definimos o source, rotas e tudo mais que precisamos para chamar 3 simples APIs.

Para isso, subi uma EC2 instance no Free Tier da AWS rodando Red Hat 8.                

Os passos para instalação do Docker-compose e do Kong estão abaixo, caso ajude alguém.

Lembrando sempre que:
1) O que funcionou para mim pode não funcionar para você.
2) Essa instalação é para fins acadêmicos somente.

====================================
-- Docker-compose Install
====================================
[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo yum update

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo dnf repolist -v

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo dnf install --nobest docker-ce --allowerasing

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo dnf install docker-ce

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo systemctl enable --now docker

[ec2-user@ip-xxx-xx-xx-xxx ~]$ systemctl is-active docker

[ec2-user@ip-xxx-xx-xx-xxx ~]$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose

[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

[ec2-user@ip-xxx-xx-xx-xxx ~]$ docker-compose -v
docker-compose version 1.23.2, build 1110ad01

Even with everything apparently OK, when I called the APIs, it gave me the error bellow:

[ec2-user@ip-xxx-xx-xx-xxx ~] docker-compose -f docker-compose-deps.yml up -d
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

I corrected by following the procedure below:

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ sudo docker version
Client: Docker Engine - Community
Version:           20.10.18
API version:       1.41
Go version:        go1.18.6
Git commit:        b40c2f6
Built:             Thu Sep  8 23:11:56 2022
OS/Arch:           linux/amd64
Context:           default
Experimental:      true

Server: Docker Engine - Community
Engine:
  Version:          20.10.18
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.6
  Git commit:       e42327a
  Built:            Thu Sep  8 23:10:04 2022
  OS/Arch:          linux/amd64
  Experimental:     false
containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ ps aux | grep docker
root       60800  0.6  7.6 1283712 63108 ?       Ssl  02:10   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ec2-user   60923  0.0  0.1 221936  1116 pts/0    R+   02:10   0:00 grep --color=auto docker

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ sudo chown $USER /var/run/docker.sock

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ sudo service docker stop
Redirecting to /bin/systemctl stop docker.service
Warning: Stopping docker.service, but it can still be activated by:
  docker.socket

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ sudo mv /var/lib/docker /var/lib/docker.bak

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ sudo service docker start
Redirecting to /bin/systemctl start docker.service

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ ps aux | grep docker
root       60800  0.6  7.6 1283712 63108 ?       Ssl  02:10   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ec2-user   60923  0.0  0.1 221936  1116 pts/0    R+   02:10   0:00 grep --color=auto docker

====================================
-- Up Kong images
====================================
[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ docker-compose up -d
Creating network "kong-net" with driver "bridge"
Pulling servicea (wesleywillians/kong-service:latest)...
latest: Pulling from wesleywillians/kong-service
6c83e83883df: Pull complete
fe092a9d933b: Pull complete
Pulling serviceb (wesleywillians/kong-service:latest)...
latest: Pulling from wesleywillians/kong-service
Creating apigateway-kong_servicec_1 ... done
Creating apigateway-kong_servicea_1 ... done
Creating apigateway-kong_serviceb_1 ... done

[ec2-user@ip-xxx-xx-xx-xxx apigateway-kong]$ cd docker-kong  

[ec2-user@ip-xxx-xx-xx-xxx docker-kong]$ docker-compose up -d
Creating volume "docker-kong_kong_data" with default driver
Pulling db (postgres:9.5)...
9.5: Pulling from library/postgres
fa1690ae9228: Pull complete
a73f6e07b158: Pull complete
973a0c44ddba: Pull complete
07e5342b01d4: Pull complete
578aad0862c9: Pull complete
a0b157088f7a: Pull complete
6c9046f06fc5: Pull complete
ae19407bdc48: Pull complete
e53b7c20aa96: Pull complete
a135edcc0831: Pull complete
fed07b1b1b94: Pull complete
18d9026fcfbd: Pull complete
4d2d5fae97d9: Pull complete
d419466e642d: Pull complete
Pulling kong (kong:2.3.2-alpine)...
2.3.2-alpine: Pulling from library/kong
e95f33c60a64: Pull complete
dab3768d001d: Pull complete
e24fc8c85ed2: Pull complete
96136c04ffee: Pull complete
Pulling kong-migrations-up (kong:2.3.2-alpine)...
2.3.2-alpine: Pulling from library/kong
Pulling konga-prepare (pantsel/konga:latest)...
latest: Pulling from pantsel/konga
cbdbe7a5bc2a: Pull complete
8f3938f7d3bd: Pull complete
6e3c12f5dc10: Pull complete
ce0cb7a9eeee: Pull complete
a87657869d4f: Pull complete
891b0102e38b: Pull complete
Creating docker-kong_db_1 ... done
Creating konga-prepare                    ... done
Creating docker-kong_kong-migrations_1    ... done
Creating konga                            ... done
Creating docker-kong_kong-migrations-up_1 ... done
Creating docker-kong_kong_1               ... done

====================================
-- List Docker services
====================================
[ec2-user@ip-xxx-xx-xx-xxx docker-kong]$ docker ps

The last steps were to configure the inbound ports on AWS Security panel. 



These links can be help you.
I hope it helps you.

Regards
Mario

Postagem em destaque

[ORACLE] Embedding ONNX model for Vector Search tests with Oracle Database 23ai

Hello, everyone. How's it going? Today, I'm going to show you how to load an ONNX model into the Oracle 23ai database for your vecto...