Compare commits
No commits in common. "eb6e6c0fbfa228438f9ceb03649440fa7b832eff" and "be1862facff24261daca64dbeeca5278b8580a41" have entirely different histories.
eb6e6c0fbf
...
be1862facf
@ -61,20 +61,19 @@ systemctl stop mysql
|
|||||||
|
|
||||||
La puesta a punto de MySQL se puede realizar de 4 maneras
|
La puesta a punto de MySQL se puede realizar de 4 maneras
|
||||||
|
|
||||||
### Esquemas, índices, variables internas de MySQL (mysqld), Hardware y S.O.
|
### 1. Esquemas, índices, variables interdas de MySQL (mysqld), Hardware y S.O.
|
||||||
|
|
||||||
#### HARDWARE
|
- HARDWARE
|
||||||
|
- Utilizar sistemas operativos de 64-bits. Mysql puede usar procesamiento
|
||||||
- Utilizar sistemas operativos de 64-bits. Mysql puede usar procesamiento
|
en paralelo y consumir toda la memoria
|
||||||
en paralelo y consumir toda la memoria
|
- Configuración de RAM. Parametro que permite indicar el máximo de memoria
|
||||||
- Configuración de RAM. Parametro que permite indicar el máximo de memoria
|
disponible para los procesos. No se recomienda exceder el 50%
|
||||||
disponible para los procesos. No se recomienda exceder el 50%
|
- Dependiendo de la forma con la que se trabaje la base de datos va a variar
|
||||||
- Dependiendo de la forma con la que se trabaje la base de datos va a variar
|
su consumo de memoria
|
||||||
su consumo de memoria
|
- El tipo del disco: HDD, SSD, NVME
|
||||||
- El tipo del disco: HDD, SSD, NVME
|
- Conexión SATA, SAS, M2, PCIe.
|
||||||
- Conexión SATA, SAS, M2, PCIe.
|
- Uso del controlador de disco **RAID** (0, 1, 5 y 10) para la seguridad
|
||||||
- Uso del controlador de disco **RAID** (0, 1, 5 y 10) para la seguridad
|
de los datos
|
||||||
de los datos
|
|
||||||
- **RAID 0**: Divide los datos en dos HD diferentes, y actuan como un
|
- **RAID 0**: Divide los datos en dos HD diferentes, y actuan como un
|
||||||
solo disco a nivel de S.O
|
solo disco a nivel de S.O
|
||||||
- **RAID 1**: Uno de los HD es copia del otro, y lo que realize en uno
|
- **RAID 1**: Uno de los HD es copia del otro, y lo que realize en uno
|
||||||
@ -86,10 +85,12 @@ de los datos
|
|||||||
- **RAID 1 y 10**: Utilizan mas espacio producto de la redundancia, pero
|
- **RAID 1 y 10**: Utilizan mas espacio producto de la redundancia, pero
|
||||||
son mas seguros por tener backup disponible
|
son mas seguros por tener backup disponible
|
||||||
|
|
||||||
|
|
||||||
> RAID [wiki](https://en.wikipedia.org/wiki/Standard_RAID_levels)
|
> RAID [wiki](https://en.wikipedia.org/wiki/Standard_RAID_levels)
|
||||||
Nested RAID [wiki](https://en.wikipedia.org/wiki/Nested_RAID_levels)
|
Nested RAID [wiki](https://en.wikipedia.org/wiki/Nested_RAID_levels)
|
||||||
RAID [ArchWiki](https://wiki.archlinux.org/title/RAID)
|
RAID [ArchWiki](https://wiki.archlinux.org/title/RAID)
|
||||||
|
|
||||||
|
|
||||||
<details><summary markdown="span">RAID</summary>
|
<details><summary markdown="span">RAID</summary>
|
||||||
|
|
||||||
#### RAID 0
|
#### RAID 0
|
||||||
@ -408,617 +409,3 @@ LOCK instance for backup;
|
|||||||
|
|
||||||
UNLOCK INSTANCE;
|
UNLOCK INSTANCE;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Plan de ejecución
|
|
||||||
|
|
||||||
Tomar como ejemplo esta consulta
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT P.codigo, YEAR(F.fecha) as "Año", SUM(I.cantidad) AS "Cantidad"
|
|
||||||
FROM productos P
|
|
||||||
INNER JOIN items I
|
|
||||||
ON P.codigo = I.codigo
|
|
||||||
INNER JOIN facturas F
|
|
||||||
ON I.numero = F.numero
|
|
||||||
GROUP BY P.codigo, YEAR(F.fecha)
|
|
||||||
ORDER BY P.codigo,YEAR(F.fecha);
|
|
||||||
```
|
|
||||||
|
|
||||||
### EXPLAIN
|
|
||||||
|
|
||||||
```sql
|
|
||||||
EXPLAIN FORMAT=JSON
|
|
||||||
SELECT P.codigo, YEAR(F.fecha) as "Año", SUM(I.cantidad) AS "Cantidad"
|
|
||||||
FROM productos P
|
|
||||||
INNER JOIN items I
|
|
||||||
ON P.codigo = I.codigo
|
|
||||||
INNER JOIN facturas F
|
|
||||||
ON I.numero = F.numero
|
|
||||||
GROUP BY P.codigo, YEAR(F.fecha)
|
|
||||||
ORDER BY P.codigo,YEAR(F.fecha)\G;
|
|
||||||
```
|
|
||||||
|
|
||||||
<details><summary markdown="span">Salida</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
*************************** 1. row ***************************
|
|
||||||
EXPLAIN: {
|
|
||||||
"query_block": {
|
|
||||||
"select_id": 1,
|
|
||||||
"filesort": {
|
|
||||||
"sort_key": "P.codigo, year(F.fecha)",
|
|
||||||
"temporary_table": {
|
|
||||||
"nested_loop": [
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "P",
|
|
||||||
"access_type": "index",
|
|
||||||
"possible_keys": ["PRIMARY"],
|
|
||||||
"key": "PRIMARY",
|
|
||||||
"key_length": "42",
|
|
||||||
"used_key_parts": ["codigo"],
|
|
||||||
"rows": 35,
|
|
||||||
"filtered": 100,
|
|
||||||
"using_index": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "I",
|
|
||||||
"access_type": "ref",
|
|
||||||
"possible_keys": ["PRIMARY", "codigo"],
|
|
||||||
"key": "codigo",
|
|
||||||
"key_length": "42",
|
|
||||||
"used_key_parts": ["codigo"],
|
|
||||||
"ref": ["empresa.P.codigo"],
|
|
||||||
"rows": 3329,
|
|
||||||
"filtered": 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "F",
|
|
||||||
"access_type": "eq_ref",
|
|
||||||
"possible_keys": ["PRIMARY"],
|
|
||||||
"key": "PRIMARY",
|
|
||||||
"key_length": "4",
|
|
||||||
"used_key_parts": ["numero"],
|
|
||||||
"ref": ["empresa.I.numero"],
|
|
||||||
"rows": 1,
|
|
||||||
"filtered": 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### ANALYZE
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ANALYZE FORMAT=JSON
|
|
||||||
SELECT P.codigo, YEAR(F.fecha) as "Año", SUM(I.cantidad) AS "Cantidad"
|
|
||||||
FROM productos P
|
|
||||||
INNER JOIN items I
|
|
||||||
ON P.codigo = I.codigo
|
|
||||||
INNER JOIN facturas F
|
|
||||||
ON I.numero = F.numero
|
|
||||||
GROUP BY P.codigo, YEAR(F.fecha)
|
|
||||||
ORDER BY P.codigo,YEAR(F.fecha)\G;
|
|
||||||
```
|
|
||||||
|
|
||||||
<details><summary markdown="span">Salida</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
*************************** 1. row ***************************
|
|
||||||
ANALYZE: {
|
|
||||||
"query_optimization": {
|
|
||||||
"r_total_time_ms": 0.587444996
|
|
||||||
},
|
|
||||||
"query_block": {
|
|
||||||
"select_id": 1,
|
|
||||||
"r_loops": 1,
|
|
||||||
"r_total_time_ms": 7608.934695,
|
|
||||||
"filesort": {
|
|
||||||
"sort_key": "P.codigo, year(F.fecha)",
|
|
||||||
"r_loops": 1,
|
|
||||||
"r_total_time_ms": 0.187826969,
|
|
||||||
"r_used_priority_queue": false,
|
|
||||||
"r_output_rows": 155,
|
|
||||||
"r_buffer_size": "6Kb",
|
|
||||||
"r_sort_mode": "sort_key,rowid",
|
|
||||||
"temporary_table": {
|
|
||||||
"nested_loop": [
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "P",
|
|
||||||
"access_type": "index",
|
|
||||||
"possible_keys": ["PRIMARY"],
|
|
||||||
"key": "PRIMARY",
|
|
||||||
"key_length": "42",
|
|
||||||
"used_key_parts": ["codigo"],
|
|
||||||
"r_loops": 1,
|
|
||||||
"rows": 35,
|
|
||||||
"r_rows": 35,
|
|
||||||
"r_table_time_ms": 0.15660869,
|
|
||||||
"r_other_time_ms": 0.195472139,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 100,
|
|
||||||
"using_index": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "I",
|
|
||||||
"access_type": "ref",
|
|
||||||
"possible_keys": ["PRIMARY", "codigo"],
|
|
||||||
"key": "codigo",
|
|
||||||
"key_length": "42",
|
|
||||||
"used_key_parts": ["codigo"],
|
|
||||||
"ref": ["empresa.P.codigo"],
|
|
||||||
"r_loops": 35,
|
|
||||||
"rows": 3329,
|
|
||||||
"r_rows": 6098.6,
|
|
||||||
"r_table_time_ms": 2265.69671,
|
|
||||||
"r_other_time_ms": 306.4226053,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 100
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "F",
|
|
||||||
"access_type": "eq_ref",
|
|
||||||
"possible_keys": ["PRIMARY"],
|
|
||||||
"key": "PRIMARY",
|
|
||||||
"key_length": "4",
|
|
||||||
"used_key_parts": ["numero"],
|
|
||||||
"ref": ["empresa.I.numero"],
|
|
||||||
"r_loops": 213451,
|
|
||||||
"rows": 1,
|
|
||||||
"r_rows": 1,
|
|
||||||
"r_table_time_ms": 2630.998751,
|
|
||||||
"r_other_time_ms": 2405.134662,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Indices
|
|
||||||
|
|
||||||
Facilitan la búsqueda de datos dentro de las tablas (Diccionario). Si no se
|
|
||||||
cuenta con una estructura de índices se debe recorrer toda la tabla hasta
|
|
||||||
encontrar el registro
|
|
||||||
|
|
||||||
### Indices en MyISAM
|
|
||||||
|
|
||||||
| ID | TITULO | AUTOR |
|
|
||||||
| - | - | - |
|
|
||||||
| 23-4567-8 | Cien años de soledad | Gabriel García Márquez |
|
|
||||||
| 12-3456-7 | El Túnel | Ernesto Sábato |
|
|
||||||
| 89-0123-4 | 1984 | George Orwell |
|
|
||||||
|
|
||||||
El índice crea estas tablas de referencia
|
|
||||||
|
|
||||||
| TITULO | Ref |
|
|
||||||
| - | - |
|
|
||||||
| 1984 | {3} |
|
|
||||||
| Cien años de soledad | {1} |
|
|
||||||
| El Túnel | {2} |
|
|
||||||
|
|
||||||
| AUTOR | Ref |
|
|
||||||
| - | - |
|
|
||||||
| Gabriel García Márquez | {1} |
|
|
||||||
| George Orwell | {3} |
|
|
||||||
| Ernesto Sábato | {2} |
|
|
||||||
|
|
||||||
| ID | Ref |
|
|
||||||
| - | - |
|
|
||||||
| 12-3456-7 | {2} |
|
|
||||||
| 23-4567-8 | {1} |
|
|
||||||
| 89-0123-4 | {3} |
|
|
||||||
|
|
||||||
- Siempre que se modifique una tabla, todos los índices se actualizan
|
|
||||||
- A mayor cantidad de datos, mayor tiempo de ejecución
|
|
||||||
- Crea una estructura separada para índices PK y no PK
|
|
||||||
- La columna inicial del índice es ordenada y toma como referencia la
|
|
||||||
posición de la fila de la tabla original
|
|
||||||
- Implenta índices **HASH** y **B-TREE**
|
|
||||||
|
|
||||||
### Indices en InnoDB
|
|
||||||
|
|
||||||
La clave primaria es el índice
|
|
||||||
|
|
||||||
| ID | TITULO | AUTOR |
|
|
||||||
| - | - | - |
|
|
||||||
| **23-4567-8** | Cien años de soledad | Gabriel García Márquez |
|
|
||||||
| **12-3456-7** | El Túnel | Ernesto Sábato |
|
|
||||||
| **89-0123-4** | 1984 | George Orwell |
|
|
||||||
|
|
||||||
Si se utiliza otro campo como índice, la referencia de este va a ser la clave
|
|
||||||
primaria
|
|
||||||
|
|
||||||
| TITULO | Ref |
|
|
||||||
| - | - |
|
|
||||||
| 1984 | 89-0123-4 |
|
|
||||||
| Cien años de soledad | 23-4567-8 |
|
|
||||||
| El Túnel | 12-3456-7 |
|
|
||||||
|
|
||||||
| AUTOR | Ref |
|
|
||||||
| - | - |
|
|
||||||
| Gabriel García Márquez | 23-4567-8 |
|
|
||||||
| George Orwell | 89-0123-4 |
|
|
||||||
| Ernesto Sábato | 12-3456-7 |
|
|
||||||
|
|
||||||
- La tabla se ordena automáticamente con la clave primaria
|
|
||||||
- Tiene mayor desempeño en consultas buscando a través de clave primaria
|
|
||||||
- En el caso de buscar en un campo que no seas llave primaria, el costo es el
|
|
||||||
mismo que usando MyISAM
|
|
||||||
- La tabla esta ordenada con la PK por defecto
|
|
||||||
- Los índices que no son PK poseen estructuras separadas y toman como
|
|
||||||
referencia el valor de la PK
|
|
||||||
- Solo trabaja con **B-TREE**
|
|
||||||
|
|
||||||
> **HASH** y **B-TREE** son algoritmos de busqueda en listas ordenadas
|
|
||||||
|
|
||||||
## Arbol Binario
|
|
||||||
|
|
||||||
- Valores a la izquierda del nodo son menores
|
|
||||||
- Valores a la derecha del nodo son mayores
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
graph TD
|
|
||||||
idA((27)) --> idB1((13))
|
|
||||||
idA --> idB2((35))
|
|
||||||
idB1 --> idC1((26))
|
|
||||||
idB2 --> idC3((33))
|
|
||||||
idB2 --> idC4((39))
|
|
||||||
```
|
|
||||||
|
|
||||||
Consideraciones sobre **B-TREE**
|
|
||||||
|
|
||||||
- Balanced - Binary Tree
|
|
||||||
- +4 Mil millones de registros en 32 niveles
|
|
||||||
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
graph TD
|
|
||||||
iA((.)) --> iB1((.))
|
|
||||||
iA((.)) --> iB2((.))
|
|
||||||
iB1((.)) --> iC1((.))
|
|
||||||
iB1((.)) --> iC2((.))
|
|
||||||
iB2((.)) --> iC3((.))
|
|
||||||
iB2((.)) --> iC4((.))
|
|
||||||
iC1((.)) --> iD1((.))
|
|
||||||
iC1((.)) --> iD2((.))
|
|
||||||
iC1((.)) --> iD3((.))
|
|
||||||
iC1((.)) --> iD4((.))
|
|
||||||
iC2((.)) --> iD5((.))
|
|
||||||
iC2((.)) --> iD6((.))
|
|
||||||
iC2((.)) --> iD7((.))
|
|
||||||
iC2((.)) --> iD8((.))
|
|
||||||
iC3((.)) --> iD9((.))
|
|
||||||
iC3((.)) --> iD10((.))
|
|
||||||
iC3((.)) --> iD11((.))
|
|
||||||
iC3((.)) --> iD12((.))
|
|
||||||
iC4((.)) --> iD13((.))
|
|
||||||
iC4((.)) --> iD14((.))
|
|
||||||
iC4((.)) --> iD15((.))
|
|
||||||
iC4((.)) --> iD16((.))
|
|
||||||
```
|
|
||||||
|
|
||||||
Ejemplo
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
%%{init: {'theme': 'dark','themeVariables': {'clusterBkg': '#2b2f38'}}}%%
|
|
||||||
graph TD
|
|
||||||
|
|
||||||
subgraph " "
|
|
||||||
A1 ---> B
|
|
||||||
A2 ---> C
|
|
||||||
A3 ---> D
|
|
||||||
subgraph A[" "]
|
|
||||||
direction TB
|
|
||||||
A1[256]
|
|
||||||
A2[521]
|
|
||||||
A3[768]
|
|
||||||
end
|
|
||||||
subgraph B[" "]
|
|
||||||
direction TB
|
|
||||||
B11[64]
|
|
||||||
B12[128]
|
|
||||||
B13[192]
|
|
||||||
end
|
|
||||||
subgraph C[" "]
|
|
||||||
direction TB
|
|
||||||
B21[256]
|
|
||||||
B22[521]
|
|
||||||
B23[768]
|
|
||||||
end
|
|
||||||
subgraph D[" "]
|
|
||||||
direction TB
|
|
||||||
B31[832]
|
|
||||||
B32[896]
|
|
||||||
B33[960]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
## HASH
|
|
||||||
|
|
||||||
Mapea datos grandes de tamaño variable en una "palabra" de tamaño fijo
|
|
||||||
|
|
||||||
Ejemplo
|
|
||||||
|
|
||||||
| Dato | Hash |
|
|
||||||
| - | - |
|
|
||||||
| ASDWERSDFJJKSHDFHKCUENVSIUUVSIUEURIHSCVIUHSER | 49855139 |
|
|
||||||
| KSDFHEHS | f9c0591e |
|
|
||||||
| 123IERUDJFH124IUDF26HD45 | f2188c85 |
|
|
||||||
| DF | 795741b2 |
|
|
||||||
|
|
||||||
[<img src="./imgs/hash_table.svg" width="1000"/>](./imgs/hash_table.svg)
|
|
||||||
|
|
||||||
## Creando indices
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ANALYZE FORMAT=JSON SELECT * FROM facturas WHERE fecha = '20170101'\G;
|
|
||||||
1 row in set (0.211 sec)
|
|
||||||
```
|
|
||||||
|
|
||||||
<details><summary markdown="span">Detalle ANALYZE</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
ANALYZE: {
|
|
||||||
"query_optimization": {
|
|
||||||
"r_total_time_ms": 0.228188173
|
|
||||||
},
|
|
||||||
"query_block": {
|
|
||||||
"select_id": 1,
|
|
||||||
"r_loops": 1,
|
|
||||||
"r_total_time_ms": 208.0312466,
|
|
||||||
"nested_loop": [
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "facturas",
|
|
||||||
"access_type": "ALL",
|
|
||||||
"r_loops": 1,
|
|
||||||
"rows": 87768,
|
|
||||||
"r_rows": 87877,
|
|
||||||
"r_table_time_ms": 159.3170115,
|
|
||||||
"r_other_time_ms": 48.68916427,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 0.08420861,
|
|
||||||
"attached_condition": "facturas.FECHA_VENTA = DATE'2017-01-01'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Agregando indice `fecha`
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ALTER TABLE facturas ADD INDEX(fecha_venta);
|
|
||||||
|
|
||||||
ANALYZE FORMAT=JSON SELECT * FROM facturas WHERE fecha = '20170101'\G;
|
|
||||||
1 row in set (0.004 sec)
|
|
||||||
```
|
|
||||||
|
|
||||||
<details><summary markdown="span">Detalle ANALYZE</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
ANALYZE: {
|
|
||||||
"query_optimization": {
|
|
||||||
"r_total_time_ms": 0.383672043
|
|
||||||
},
|
|
||||||
"query_block": {
|
|
||||||
"select_id": 1,
|
|
||||||
"r_loops": 1,
|
|
||||||
"r_total_time_ms": 1.303775168,
|
|
||||||
"nested_loop": [
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "facturas",
|
|
||||||
"access_type": "ref",
|
|
||||||
"possible_keys": ["FECHA_VENTA"],
|
|
||||||
"key": "FECHA_VENTA",
|
|
||||||
"key_length": "4",
|
|
||||||
"used_key_parts": ["FECHA_VENTA"],
|
|
||||||
"ref": ["const"],
|
|
||||||
"r_loops": 1,
|
|
||||||
"rows": 74,
|
|
||||||
"r_rows": 74,
|
|
||||||
"r_table_time_ms": 1.180700563,
|
|
||||||
"r_other_time_ms": 0.099922552,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
#### Quitando el índice
|
|
||||||
|
|
||||||
```sql
|
|
||||||
ALTER TABLE facturas DROP INDEX(fecha_venta);
|
|
||||||
|
|
||||||
ANALYZE FORMAT=JSON SELECT * FROM facturas WHERE fecha = '20170101'\G;
|
|
||||||
1 row in set (0.180 sec)
|
|
||||||
```
|
|
||||||
|
|
||||||
<details><summary markdown="span">Detalle ANALYZE</summary>
|
|
||||||
|
|
||||||
```json
|
|
||||||
ANALYZE: {
|
|
||||||
"query_optimization": {
|
|
||||||
"r_total_time_ms": 0.192326251
|
|
||||||
},
|
|
||||||
"query_block": {
|
|
||||||
"select_id": 1,
|
|
||||||
"r_loops": 1,
|
|
||||||
"r_total_time_ms": 177.6817744,
|
|
||||||
"nested_loop": [
|
|
||||||
{
|
|
||||||
"table": {
|
|
||||||
"table_name": "facturas",
|
|
||||||
"access_type": "ALL",
|
|
||||||
"r_loops": 1,
|
|
||||||
"rows": 87768,
|
|
||||||
"r_rows": 87877,
|
|
||||||
"r_table_time_ms": 135.9970415,
|
|
||||||
"r_other_time_ms": 41.66515984,
|
|
||||||
"filtered": 100,
|
|
||||||
"r_filtered": 0.08420861,
|
|
||||||
"attached_condition": "facturas.FECHA_VENTA = DATE'2017-01-01'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
|
||||||
### Plan de ejecución gráfico en Workbench
|
|
||||||
|
|
||||||
Ejemplo
|
|
||||||
|
|
||||||
[<img src="./imgs/wb-visual-explain-hash-join-sakila.png" width="350"/>](./imgs/wb-visual-explain-hash-join-sakila.png)
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT P.codigo_del_producto, I.cantidad FROM tabla_de_productos P
|
|
||||||
INNER JOIN items_facturas I
|
|
||||||
ON P.codigo_del_producto = I.codigo_del_producto;
|
|
||||||
```
|
|
||||||
|
|
||||||
[<img src="./imgs/graph_cost_query1.png" width="400"/>](./imgs/graph_cost_query1.png)
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT P.codigo_del_producto, YEAR(F.fecha_venta) AS "AÑO", I.cantidad
|
|
||||||
FROM tabla_de_productos P
|
|
||||||
INNER JOIN items_facturas I
|
|
||||||
ON P.codigo_del_producto = I.codigo_del_producto
|
|
||||||
INNER JOIN facturas F ON I.numero = F.numero;
|
|
||||||
```
|
|
||||||
|
|
||||||
[<img src="./imgs/graph_cost_query2.png" width="450"/>](./imgs/graph_cost_query2.png)
|
|
||||||
|
|
||||||
Sin índices ni claves primarias
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT P.codigo_del_producto, YEAR(F.fecha_venta) AS "AÑO", I.cantidad
|
|
||||||
FROM tabla_de_productos2 P
|
|
||||||
INNER JOIN items_facturas2 I
|
|
||||||
ON P.codigo_del_producto = I.codigo_del_producto
|
|
||||||
INNER JOIN facturas2 F ON I.numero = F.numero;
|
|
||||||
```
|
|
||||||
|
|
||||||
[<img src="./imgs/graph_cost_query3.png" width="450"/>](./imgs/graph_cost_query3.png)
|
|
||||||
|
|
||||||
### mysqslap
|
|
||||||
|
|
||||||
`mysqslap` o `mariadb-slap`
|
|
||||||
|
|
||||||
```txt
|
|
||||||
mariadb-slap -u <user> -p -h <dbaddres> -P 3306 \
|
|
||||||
--concurrency=100 --iterations=10 --create-schema=jugos2 \
|
|
||||||
--query="SELECT * FROM facturas WHERE fecha_venta='20170101'";
|
|
||||||
Enter password:
|
|
||||||
Benchmark
|
|
||||||
Average number of seconds to run all queries: 15.112 seconds
|
|
||||||
Minimum number of seconds to run all queries: 15.022 seconds
|
|
||||||
Maximum number of seconds to run all queries: 15.287 seconds
|
|
||||||
Number of clients running queries: 100
|
|
||||||
Average number of queries per client: 1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Administración de usuarios
|
|
||||||
|
|
||||||
Esto se puede realizar desde Workbench:
|
|
||||||
|
|
||||||
`-> Pestaña Administración -> Users and Privileges` Donde se pueden escoger
|
|
||||||
los roles que se quieran asignar al usuario
|
|
||||||
|
|
||||||
### User Administrador Manual
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE USER 'dbadmin-user' identified by 'dbadmin-password';
|
|
||||||
GRANT USAGE ON *.* TO `%`@`%` IDENTIFIED BY 'dbadmin-password';
|
|
||||||
GRANT ALL PRIVILEGES ON *.* TO 'dbadmin-user'@`%` WITH GRANT OPTION;
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usuario con privilegios para schema `schema1`, uso local
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE USER 'basic-admin' identified by 'basic-admin-password';
|
|
||||||
GRANT USAGE ON 'schema1'.* TO 'basic-admin'@'localhost' IDENTIFIED BY 'basic-admin-password';
|
|
||||||
GRANT ALL PRIVILEGES ON 'schema1'.* TO 'basic-admin'@`%`;
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usuario con privilegios limitados
|
|
||||||
|
|
||||||
`SELECT`, `UPDATE`, `INSERT`, `DELETE`, `EXECUTE`, `LOCK TABLES`, `CREATE TEMPORARY TABLES` para schema `schema1`, uso local:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE USER 'limited-user' identified by 'limited-user-password';
|
|
||||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE TEMPORARY TABLES, LOCK TABLES,
|
|
||||||
EXECUTE ON 'schema1'.* TO 'limited-user'@'localhost'
|
|
||||||
IDENTIFIED BY 'limited-user-password';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usuario con privilegios solo lectura
|
|
||||||
|
|
||||||
Para todas los schemas con acceso remoto:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE USER 'limited-user' identified by 'limited-user-password';
|
|
||||||
GRANT SELECT, EXECUTE ON *.* TO 'limited-user'@'%'
|
|
||||||
IDENTIFIED BY 'limited-user-password';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Backup user
|
|
||||||
|
|
||||||
```sql
|
|
||||||
CREATE USER 'backup-user' identified by 'backup-user-password';
|
|
||||||
GRANT SELECT, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup-user'@'%'
|
|
||||||
IDENTIFIED BY 'backup-user-password';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Limitando accesos remotos
|
|
||||||
|
|
||||||
- `192.168.1.%`: 192.168.1.0 - 192.168.1.255
|
|
||||||
- `192.168.1.1_`: 192.168.1.100 - 192.168.1.255
|
|
||||||
- `cliente_.empresa.com`: clientXY.empresa.com
|
|
||||||
|
|
||||||
### Revocar todos los privilegios
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SHOW GRANTS FOR 'usuario'@'localhost';
|
|
||||||
REVOKE ALL PRIVILEGES, GRATN OPTION FROM 'user'@'localhost';
|
|
||||||
```
|
|
||||||
|
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 40 KiB |
@ -1,254 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<!-- Created on 2009-04-10 by Jorge Stolfi with the script make-hash-table-figure -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
width="450.0"
|
|
||||||
height="310.0"
|
|
||||||
id="fig"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-opacity="1"
|
|
||||||
stroke-linecap="round"
|
|
||||||
fill-opacity="1"
|
|
||||||
fill-rule="evenodd"
|
|
||||||
font-family="Bitstream Courier"
|
|
||||||
font-style="normal"
|
|
||||||
font-weight="normal"
|
|
||||||
pagecolor="#ffff00"
|
|
||||||
pageopacity="0.0">
|
|
||||||
|
|
||||||
|
|
||||||
<g
|
|
||||||
font-size="12px"
|
|
||||||
transform="scale(1.0) translate(10,60)"
|
|
||||||
>
|
|
||||||
|
|
||||||
<defs>
|
|
||||||
<!-- Start marker for non-null pointers: -->
|
|
||||||
<marker id="linkdot_N" viewBox="0 0 8 8" refX="4" refY="4" markerWidth="8" markerHeight="8" orient="auto">
|
|
||||||
<circle cx="4" cy="4" r="3" stroke="#000000" fill="#000000" />
|
|
||||||
</marker>
|
|
||||||
<!-- Start marker for null pointers: -->
|
|
||||||
<marker id="linkdot_U" viewBox="0 0 8 8" refX="4" refY="4" markerWidth="8" markerHeight="8" orient="auto">
|
|
||||||
<line x1="1" y1="1" x2="7" y2="7" stroke="#000000" />
|
|
||||||
<line x1="1" y1="7" x2="7" y2="1" stroke="#000000" />
|
|
||||||
</marker>
|
|
||||||
|
|
||||||
<!-- Tip for arrows: -->
|
|
||||||
<marker id="arrowtip_N" viewBox="0 0 14 8" refX="13" refY="4" markerWidth="14" markerHeight="8" orient="auto">
|
|
||||||
<polygon points="1,4 1,1 13,4 1,7" stroke="#000000" fill="#000000" />
|
|
||||||
</marker>
|
|
||||||
<!-- Tip for highlighted arrows: -->
|
|
||||||
<marker id="arrowtip_C" viewBox="0 0 14 8" refX="13" refY="4" markerWidth="14" markerHeight="8" orient="auto">
|
|
||||||
<polygon points="1,4 1,1 13,4 1,7" stroke="#cc0000" fill="#cc0000" />
|
|
||||||
</marker>
|
|
||||||
|
|
||||||
<!-- Key box in input column, normal: -->
|
|
||||||
<rect id="key_box_N" y="0" x="0" width="90" height="20" fill="#00ffff" stroke="none" />
|
|
||||||
<!-- Key box in input column, highlighted : -->
|
|
||||||
<rect id="key_box_C" y="0" x="0" width="90" height="20" fill="#00ffff" stroke="none" />
|
|
||||||
<!-- Key box in bucket or overflow columns, normal: -->
|
|
||||||
<rect id="key_box_E" y="0" x="0" width="90" height="20" fill="#9cff9c" stroke="#000000" />
|
|
||||||
<!-- Key box in bucket or overflow columns, vacant: -->
|
|
||||||
<rect id="key_box_U" y="0" x="0" width="90" height="20" fill="#ddeedd" stroke="#000000" />
|
|
||||||
|
|
||||||
<!-- Value box in bucket or overflow columns, occupied: -->
|
|
||||||
<rect id="val_box_E" y="0" x="0" width="80" height="20" fill="#9cff9c" stroke="#000000" />
|
|
||||||
<!-- Value box in bucket or overflow columns, vacant: -->
|
|
||||||
<rect id="val_box_U" y="0" x="0" width="80" height="20" fill="#ddeedd" stroke="#000000" />
|
|
||||||
|
|
||||||
<!-- Pointer box in bucket or overflow columns, used and non-null: -->
|
|
||||||
<rect id="ptr_box_E" y="0" x="0" width="20" height="20" fill="#9cff9c" stroke="#000000" />
|
|
||||||
<!-- Pointer box in bucket or overflow columns, null/vacant: -->
|
|
||||||
<rect id="ptr_box_U" y="0" x="0" width="20" height="20" fill="#ddeedd" stroke="#000000" />
|
|
||||||
|
|
||||||
<!-- Background for hash value, unused: -->
|
|
||||||
<rect id="hsh_box_U" x="3" y="1" width="34" height="18" fill="#ddeedd" stroke="none" />
|
|
||||||
<!-- Background for hash value, used: -->
|
|
||||||
<rect id="hsh_box_N" x="3" y="1" width="34" height="18" fill="#a8a8ff" stroke="none" />
|
|
||||||
<!-- Background for hash value, highlighted: -->
|
|
||||||
<rect id="hsh_box_C" x="3" y="1" width="34" height="18" fill="#ee4444" stroke="none" />
|
|
||||||
|
|
||||||
<!-- Vertical dots: -->
|
|
||||||
<g id="vdots">
|
|
||||||
<rect x="0" y="06" width="2" height="2" />
|
|
||||||
<rect x="0" y="12" width="2" height="2" />
|
|
||||||
</g>
|
|
||||||
</defs>
|
|
||||||
|
|
||||||
<!-- Keys and hash function -->
|
|
||||||
<g transform="translate(0,000)" text-anchor="middle" stroke="none">
|
|
||||||
|
|
||||||
<text x="45" y="-10" font-size="15px" font-weight="bold" fill="#000000" stroke="none"> keys
|
|
||||||
</text>
|
|
||||||
|
|
||||||
<g transform="translate(0,30)">
|
|
||||||
<use xlink:href="#key_box_C" />
|
|
||||||
<text x="45" y="14" stroke="none">John Smith</text>
|
|
||||||
<line x1="95" y1="10" x2="100" y2="10" stroke="#dd0000" />
|
|
||||||
<line x1="100" y1="10" x2="130" y2="80" stroke="#dd0000" />
|
|
||||||
<line x1="130" y1="80" x2="150" y2="80" stroke="#dd0000" marker-end="url(#arrowtip_C)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(0,70)">
|
|
||||||
<use xlink:href="#key_box_N" />
|
|
||||||
<text x="45" y="14" stroke="none">Lisa Smith</text>
|
|
||||||
<line x1="95" y1="10" x2="100" y2="10" stroke="#000000" />
|
|
||||||
<line x1="100" y1="10" x2="130" y2="-40" stroke="#000000" />
|
|
||||||
<line x1="130" y1="-40" x2="150" y2="-40" stroke="#000000" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(0,110)">
|
|
||||||
<use xlink:href="#key_box_N" />
|
|
||||||
<text x="45" y="14" stroke="none">Sam Doe</text>
|
|
||||||
<line x1="95" y1="10" x2="100" y2="10" stroke="#000000" />
|
|
||||||
<line x1="100" y1="10" x2="130" y2="100" stroke="#000000" />
|
|
||||||
<line x1="130" y1="100" x2="150" y2="100" stroke="#000000" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(0,150)">
|
|
||||||
<use xlink:href="#key_box_C" />
|
|
||||||
<text x="45" y="14" stroke="none">Sandra Dee</text>
|
|
||||||
<line x1="95" y1="10" x2="100" y2="10" stroke="#dd0000" />
|
|
||||||
<line x1="100" y1="10" x2="130" y2="-40" stroke="#dd0000" />
|
|
||||||
<line x1="130" y1="-40" x2="150" y2="-40" stroke="#dd0000" marker-end="url(#arrowtip_C)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(0,190)">
|
|
||||||
<use xlink:href="#key_box_N" />
|
|
||||||
<text x="45" y="14" stroke="none">Ted Baker</text>
|
|
||||||
<line x1="95" y1="10" x2="100" y2="10" stroke="#000000" />
|
|
||||||
<line x1="100" y1="10" x2="130" y2="-60" stroke="#000000" />
|
|
||||||
<line x1="130" y1="-60" x2="150" y2="-60" stroke="#000000" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
|
|
||||||
</g>
|
|
||||||
|
|
||||||
<!-- Hash values and bucket array -->
|
|
||||||
<g transform="translate(150,000)" text-anchor="middle" stroke="none">
|
|
||||||
|
|
||||||
<text x="50" y="-10" font-size="15px" font-weight="bold" fill="#000000" stroke="none">
|
|
||||||
buckets
|
|
||||||
</text>
|
|
||||||
|
|
||||||
<g transform="translate(000,0)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">000</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,20)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_N" />
|
|
||||||
<text x="20" y="14">001</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="50" y1="10" x2="90" y2="0" stroke="#000000" marker-start="url(#linkdot_N)" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,40)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">002</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,60)">
|
|
||||||
<text x="20" y="14" font-weight="bold">:</text>
|
|
||||||
<text x="50" y="14" font-weight="bold">:</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,80)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">151</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,100)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_C" />
|
|
||||||
<text x="20" y="14">152</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="50" y1="10" x2="90" y2="-30" stroke="#000000" marker-start="url(#linkdot_N)" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,120)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_N" />
|
|
||||||
<text x="20" y="14">153</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="50" y1="10" x2="90" y2="50" stroke="#000000" marker-start="url(#linkdot_N)" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,140)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">154</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,160)">
|
|
||||||
<text x="20" y="14" font-weight="bold">:</text>
|
|
||||||
<text x="50" y="14" font-weight="bold">:</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,180)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">253</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,200)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_N" />
|
|
||||||
<text x="20" y="14">254</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="50" y1="10" x2="90" y2="20" stroke="#000000" marker-start="url(#linkdot_N)" marker-end="url(#arrowtip_N)" />
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,220)">
|
|
||||||
<use x="0" xlink:href="#hsh_box_U" />
|
|
||||||
<text x="20" y="14">255</text>
|
|
||||||
<use x="40" xlink:href="#ptr_box_U" />
|
|
||||||
<line x1="50" y1="10" x2="50.000999999999998" y2="10" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
</g>
|
|
||||||
|
|
||||||
</g>
|
|
||||||
|
|
||||||
<!-- Hash values and bucket array -->
|
|
||||||
<g transform="translate(240,000)" text-anchor="middle" stroke="none">
|
|
||||||
|
|
||||||
<text x="95" y="-10" font-size="15px" font-weight="bold" fill="#000000" stroke="none">
|
|
||||||
entries
|
|
||||||
</text>
|
|
||||||
|
|
||||||
<g transform="translate(000,10)">
|
|
||||||
<use x="0" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="10" y1="10" x2="10" y2="10.000999999999999" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
<use x="20" xlink:href="#key_box_E" />
|
|
||||||
<text x="65" y="14">Lisa Smith</text>
|
|
||||||
<use x="110" xlink:href="#val_box_E" />
|
|
||||||
<text x="150" y="14">521-8976</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,60)">
|
|
||||||
<use x="0" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="10" y1="10" x2="10" y2="50" stroke="#000000" marker-start="url(#linkdot_N)" marker-end="url(#arrowtip_N)" />
|
|
||||||
<use x="20" xlink:href="#key_box_E" />
|
|
||||||
<text x="65" y="14">John Smith</text>
|
|
||||||
<use x="110" xlink:href="#val_box_E" />
|
|
||||||
<text x="150" y="14">521-1234</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,110)">
|
|
||||||
<use x="0" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="10" y1="10" x2="10" y2="10.000999999999999" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
<use x="20" xlink:href="#key_box_E" />
|
|
||||||
<text x="65" y="14">Sandra Dee</text>
|
|
||||||
<use x="110" xlink:href="#val_box_E" />
|
|
||||||
<text x="150" y="14">521-9655</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,160)">
|
|
||||||
<use x="0" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="10" y1="10" x2="10" y2="10.000999999999999" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
<use x="20" xlink:href="#key_box_E" />
|
|
||||||
<text x="65" y="14">Ted Baker</text>
|
|
||||||
<use x="110" xlink:href="#val_box_E" />
|
|
||||||
<text x="150" y="14">418-4165</text>
|
|
||||||
</g>
|
|
||||||
<g transform="translate(000,210)">
|
|
||||||
<use x="0" xlink:href="#ptr_box_E" />
|
|
||||||
<line x1="10" y1="10" x2="10" y2="10.000999999999999" stroke="#000000" marker-start="url(#linkdot_U)" />
|
|
||||||
<use x="20" xlink:href="#key_box_E" />
|
|
||||||
<text x="65" y="14">Sam Doe</text>
|
|
||||||
<use x="110" xlink:href="#val_box_E" />
|
|
||||||
<text x="150" y="14">521-5030</text>
|
|
||||||
</g>
|
|
||||||
|
|
||||||
</g>
|
|
||||||
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.9 KiB |
@ -7,42 +7,38 @@ while read LINE; do
|
|||||||
declare "$LINE" 2>/dev/null
|
declare "$LINE" 2>/dev/null
|
||||||
done < $BASEDIR/.env
|
done < $BASEDIR/.env
|
||||||
|
|
||||||
maria_connect(){
|
connect_db(){
|
||||||
echo "mariadb -u ${DBUSER} -p${DBPASS} -h ${DBADDR%%:*} ${DBNAME} -P ${DBADDR##*:}"
|
echo "mariadb -u ${DBUSER} -p${DBPASS} -h ${DBADDR%%:*} ${DBNAME} -P ${DBADDR##*:}"
|
||||||
}
|
}
|
||||||
|
|
||||||
connect_db(){
|
|
||||||
$(maria_connect)
|
|
||||||
}
|
|
||||||
|
|
||||||
create_tables(){
|
create_tables(){
|
||||||
$(maria_connect) < ./create_tables.sql
|
$(connect_db) < ./create_tables.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
populate_tables(){
|
populate_tables(){
|
||||||
$(maria_connect) < ./populate_tables.sql
|
$(connect_db) < ./populate_tables.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
import_records(){
|
import_records(){
|
||||||
$(maria_connect) < ./import_records.sql
|
$(connect_db) < ./import_records.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
re_create_tables(){
|
re_create_tables(){
|
||||||
$(maria_connect) < ./re_create_tables.sql
|
$(connect_db) < ./re_create_tables.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
create_f_sp(){
|
create_f_sp(){
|
||||||
$(maria_connect) < ./funcs_sp.sql
|
$(connect_db) < ./funcs_sp.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
create_triggers(){
|
create_triggers(){
|
||||||
$(maria_connect) < ./triggers.sql
|
$(connect_db) < ./triggers.sql
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivate_session(){
|
deactivate_session(){
|
||||||
unset DBNAME DBUSER DBPASS DBADDR PEPPER
|
unset DBNAME DBUSER DBPASS DBADDR PEPPER
|
||||||
unset VersionStr BASEDIR connect_db
|
unset VersionStr BASEDIR
|
||||||
unset maria_connect create_populate_tables
|
unset connect_db create_populate_tables
|
||||||
unset populate_tables import_records
|
unset populate_tables import_records
|
||||||
unset re_create_tables create_f_sp
|
unset re_create_tables create_f_sp
|
||||||
unset create_triggers deactivate_session
|
unset create_triggers deactivate_session
|
||||||
|
@ -1,592 +0,0 @@
|
|||||||
# Oracle Cloud Infrastructure
|
|
||||||
|
|
||||||
## Cloud Computing
|
|
||||||
|
|
||||||
Basicamente es el uso de servicio como servidores, almacenamiento, redes, bases
|
|
||||||
de datos y otros recursos computacionales a través de internet.
|
|
||||||
|
|
||||||
![img](./imgs/servers.jpg)
|
|
||||||
|
|
||||||
### Beneficios de uso de la Nube
|
|
||||||
|
|
||||||
1. Costos
|
|
||||||
2. Velocidad
|
|
||||||
3. Escalabilidad
|
|
||||||
4. Productividad
|
|
||||||
5. Desempeño
|
|
||||||
6. Confiabilidad
|
|
||||||
7. Seguridad
|
|
||||||
|
|
||||||
### Tipos de Nube
|
|
||||||
|
|
||||||
- Nube Publica
|
|
||||||
- Nube Privada
|
|
||||||
- Nube Híbrida
|
|
||||||
|
|
||||||
### Tipos de servicios en la Nube
|
|
||||||
|
|
||||||
- **IaaS** Infrastructure as a Service
|
|
||||||
|
|
||||||
El tipo más común de servicio en la Nube.
|
|
||||||
Bajo laaS, el proveedor de la Nube proporciona la infraestructura de TI, como
|
|
||||||
servidores, almacenamiento y redes, y se paga de acuerdo al uso.
|
|
||||||
La mayoría de los recursos de TI ofrecidos en el modelo IaaS no están
|
|
||||||
pre-configurados, lo que significa que el consumidor tiene un alto grado de
|
|
||||||
control sobre el entorno en la Nube. Él es quien debe configurar y mantener
|
|
||||||
cualquier software que desee ejecutar sobre la infraestructura provista.
|
|
||||||
|
|
||||||
El IaaS ganó fuerza significativa en los últimos años, especialmente con
|
|
||||||
startups y divisiones independientes de empresas más grandes que tuvieran un
|
|
||||||
crecimiento rápido y busquen construir sus propias aplicaciones esenciales
|
|
||||||
para el negocio, pero evitan la inversión y el mantenimiento que la
|
|
||||||
infraestructura requerirá.
|
|
||||||
|
|
||||||
Además se trata de empresas que muchas veces buscan escalabilidad inmediata,
|
|
||||||
ya que por el rápido crecimiento, necesitan estar preparados para lidiar con
|
|
||||||
un volumen cada vez mayor de trabajo. Con IaaS existe la posibilidad de
|
|
||||||
comprar un nuevo servidor virtual, instalarlo por cuenta propia y obtener esa
|
|
||||||
capacidad adicional en una porción de tiempo mas pequeño.
|
|
||||||
|
|
||||||
- **PaaS** Platform as a Service
|
|
||||||
|
|
||||||
PaaS (que significa plataforma como servicio) es un modelo informático en el
|
|
||||||
cual el proveedor de la Nube te asigna, configura y gestiona toda la
|
|
||||||
infraestructura informática, como servidores, redes como en IaaS, así como
|
|
||||||
sistemas operativos, bases de datos, herramientas de desarrollo y
|
|
||||||
administración de empresas.
|
|
||||||
|
|
||||||
En otras palabras, en PaaS toda la configuración de la base de datos, la
|
|
||||||
seguridad y las replicaciones son realizadas por el proveedor con pocos
|
|
||||||
márgenes de configuración, diferente de IaaS, donde las principales
|
|
||||||
configuraciones son hechas por el desarrollador, lo que hace que PaaS sea
|
|
||||||
más costosa que IaaS.
|
|
||||||
|
|
||||||
PaaS es un ambiente de informático listo para su uso, una vez que los
|
|
||||||
recursos y servicios ya están implementados y configurados. Los servicios
|
|
||||||
informáticos PaaS incluyen aquellos que lo ayudan a desarrollar, probar y
|
|
||||||
entregar aplicaciones de software personalizadas.
|
|
||||||
|
|
||||||
Los desarrolladores pueden crear sus aplicaciones rápidamente y un proveedor
|
|
||||||
de la Nube configura y administra la infraestructura informática subyacente.
|
|
||||||
El consumidor puede reemplazar todo el ambiente informático local por el de
|
|
||||||
PaaS o usar PaaS para expandir su ambiente de TI y/o reducir costos con el
|
|
||||||
ambiente en la nube.
|
|
||||||
|
|
||||||
- **SaaS** Software as a Service
|
|
||||||
|
|
||||||
SaaS es como un proveedor de la Nube que ofrece aplicaciones de software bajo
|
|
||||||
demanda. En este modelo, el proveedor administra no solo la infraestructura
|
|
||||||
sino también las aplicaciones de software y los usuarios que se conectan a
|
|
||||||
la aplicación a través de internet.
|
|
||||||
|
|
||||||
El software se modela como un servicio de la Nube compartido y disponible
|
|
||||||
para los usuarios como un producto. Los consumidores de la Nube tienen el
|
|
||||||
control administrativo y de gestión limitado.
|
|
||||||
|
|
||||||
Un ejemplo bien conocido de SaaS es Spotify, que es un servicio de música de
|
|
||||||
streaming, podcast y video que fue lanzado en Octubre de 2008 en Estocolmo,
|
|
||||||
Suecia. Es el servicio de streaming más popular y mas usado en todo el mundo.
|
|
||||||
|
|
||||||
SaaS es esencialmente la entrega de aplicaciones directamente de la Nube para
|
|
||||||
usuarios individuales. El hardware que procesa los datos como así también el
|
|
||||||
sistema operativo y no le importará nada para los usuarios finales. que
|
|
||||||
acceden a estas aplicaciones a través de una plataforma como Chrome, Firefox,
|
|
||||||
Safari, Google Play o Apple Store.
|
|
||||||
|
|
||||||
Organizaciones de todos los tamaños han migrado a SaaS. ¿Y por que no?, Por
|
|
||||||
lo tanto no necesitan invertir en mucho hardware y sistemas operativos caros.
|
|
||||||
Además, no tienen que pagar un equipo de TI para mantener la infraestructura
|
|
||||||
o solucionar problemas de las aplicaciones.
|
|
||||||
|
|
||||||
El proveedor de SaaS ofrece todo eso. En caso de no utilizar un proveedor de
|
|
||||||
SaaS, las empresas necesitan comprar una licencia perpetua para ejecutar una
|
|
||||||
aplicación de software en sus sistemas.
|
|
||||||
|
|
||||||
- **Serverless** λ
|
|
||||||
|
|
||||||
> Lectura
|
|
||||||
[¿Que es Cloud?](https://www.aluracursos.com/blog/que-es-cloud-y-sus-principales-servicios)
|
|
||||||
|
|
||||||
|
|
||||||
### Principales proveedores
|
|
||||||
|
|
||||||
- [AWS](https://aws.amazon.com/)
|
|
||||||
|
|
||||||
- Microsoft [Azure](https://azure.microsoft.com/)
|
|
||||||
|
|
||||||
- [Google Cloud Platform](https://cloud.google.com/)
|
|
||||||
|
|
||||||
- Oracle Cloud Infrastructure [OCI](https://www.oracle.com/es/cloud/)
|
|
||||||
|
|
||||||
|
|
||||||
## Cloud Shell
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Welcome to Oracle Cloud Shell.
|
|
||||||
|
|
||||||
Upgrade Notification: In the near future your Cloud Shell session will be hosted
|
|
||||||
on virtual machines based on the ARM64 architecture. Most users will be given the
|
|
||||||
option to choose the VM architecture for their session. Cloud Shell will also be
|
|
||||||
upgrading to Oracle Linux 8. Stay tuned for further updates.
|
|
||||||
|
|
||||||
The OCI Ruby SDK will no longer be preinstalled in Cloud Shell. To install the
|
|
||||||
OCI Ruby SDK, see https://github.com/oracle/oci-ruby-sdk.
|
|
||||||
|
|
||||||
NOTICE: The Metadata Service 1 endpoint is deprecated and will soon be disabled.
|
|
||||||
When accessing the Metadata Service from Cloud Shell, use the Metadata Service 2
|
|
||||||
endpoint. For more information,
|
|
||||||
see https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm
|
|
||||||
|
|
||||||
Your Cloud Shell machine comes with 5GB of storage for your home directory. Your
|
|
||||||
Cloud Shell (machine and home directory) are located in: US West (Phoenix).
|
|
||||||
You are using Cloud Shell in tenancy <USER> as an OCI local user <USUARIO>
|
|
||||||
|
|
||||||
Type `help` for more info.
|
|
||||||
=================================================================================
|
|
||||||
|
|
||||||
Welcome to the Oracle Cloud Shell Tutorial
|
|
||||||
|
|
||||||
Cloud Shell is a web-based terminal which includes many useful tools including
|
|
||||||
current versions of the OCI CLI and SDKs.
|
|
||||||
Would you like to run a tutorial to learn more about all the features included in
|
|
||||||
Cloud Shell? (Type N to quit) [Y|N]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cloud Shell tutorial
|
|
||||||
|
|
||||||
<details>
|
|
||||||
|
|
||||||
<summary markdown="span"><b>Tutorial</b></summary>
|
|
||||||
|
|
||||||
### About This Tutorial
|
|
||||||
|
|
||||||
```txt
|
|
||||||
This is a command line tutorial that runs the first time you start Cloud Shell
|
|
||||||
and provides a quick introduction to the service. You can quit this tutorial at
|
|
||||||
any time.
|
|
||||||
If you would like to run it again, you can do that by typing cstutorial in your
|
|
||||||
Cloud Shell terminal at any time.
|
|
||||||
```
|
|
||||||
|
|
||||||
### This tutorial is going to cover
|
|
||||||
|
|
||||||
```txt
|
|
||||||
* How to use Cloud Shell
|
|
||||||
* Identifying tools available in Cloud Shell
|
|
||||||
* Programming language support from Cloud Shell and how to manage your
|
|
||||||
Java Development Kit (JDK) versions
|
|
||||||
* Running OCI Command Line Interface (CLI) Commands and using OCI's
|
|
||||||
Interactive CLI
|
|
||||||
* Using the OCI SDKs
|
|
||||||
```
|
|
||||||
|
|
||||||
### What is Cloud Shell?
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Cloud Shell is a free web browser-based terminal accessible from the Oracle Cloud
|
|
||||||
Console that is pre-installed with a set of useful tools. Each user is provided a
|
|
||||||
5 GB home directory which provides persistent storage for your files.
|
|
||||||
|
|
||||||
Cloud Shell allows you to perform tasks including:
|
|
||||||
|
|
||||||
* Writing Linux scripts for managing your Oracle Cloud Infrastructure (OCI)
|
|
||||||
environment
|
|
||||||
* Developing or running applications built using the OCI SDKs
|
|
||||||
* Building and running docker containers
|
|
||||||
* Managing your Oracle Cloud Infrastructure (OCI) Functions
|
|
||||||
* Accessing public and private resources including:
|
|
||||||
* Running OCI CLI commands to manage your resources
|
|
||||||
* Accessing your Oracle Container Engine for Kubernetes clusters
|
|
||||||
* Accessing your compute instances using ssh
|
|
||||||
* Managing your Autonomous Databases
|
|
||||||
|
|
||||||
Your persistent home directory allows you to store scripts and files in your
|
|
||||||
Cloud Shell which will be retained for your next session even if you exit or
|
|
||||||
restart Cloud Shell. Those files live in your Cloud Shell environment and can
|
|
||||||
not be accessed by other users.
|
|
||||||
|
|
||||||
The OCI CLI is pre-configured to run as you with all of the policies and
|
|
||||||
privileges that have been assigned to you by your Administrator. No additional
|
|
||||||
set up is required to use it.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tools Available in Cloud Shell
|
|
||||||
|
|
||||||
```txt
|
|
||||||
CloudShell provides a collection of pre-installed and pre-authenticated tools
|
|
||||||
readily accessible to users which are updated on a regular basis including:
|
|
||||||
|
|
||||||
* OCI Command Line Interface (CLI)
|
|
||||||
* Source Code Management: Git
|
|
||||||
* SQL: SQLcl, mysql-community-client
|
|
||||||
* Kubernetes utilities: kubectl, helm
|
|
||||||
* Build tools: maven, make
|
|
||||||
* Provisioning and configuration management: terraform, ansible
|
|
||||||
* Editors: vim, nano, emacs
|
|
||||||
* Linux Shells: bash, sh, tmux
|
|
||||||
* Linux utilities: iputils, jq, wget, zip/unzip, tar (and many more)
|
|
||||||
* Python tools: pip, iPython
|
|
||||||
* Typescript/Javascript support: node.js, NPM, nvm
|
|
||||||
* Docker: Docker engine
|
|
||||||
* oci-powershell-modules
|
|
||||||
* GoldenGate Admin client
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using the OCI Command Line Interface (CLI)
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Included in Cloud Shell is a current version of the OCI CLI. The CLI is a
|
|
||||||
small-footprint tool that you can use on its own or with the Console to complete
|
|
||||||
Oracle Cloud Infrastructure
|
|
||||||
tasks. The CLI provides the same core functionality as the Console, plus
|
|
||||||
additional commands. Some of these, such as the ability to write and run scripts,
|
|
||||||
extend Console functionality.
|
|
||||||
|
|
||||||
Cloud Shell updates the version of the OCI CLI on a regular basis. This means you
|
|
||||||
are always using the latest version of our tools. We also automatically configure
|
|
||||||
your credentials when
|
|
||||||
you launch Cloud Shell so no further setup is required to use the OCI CLI in
|
|
||||||
Cloud Shell. Authentication happens automatically.
|
|
||||||
|
|
||||||
Hit return to run the oci command oci iam availability-domain list :
|
|
||||||
|
|
||||||
$ oci iam availability-domain list
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using the OCI CLI in Interactive Mode
|
|
||||||
|
|
||||||
```txt
|
|
||||||
The CLI also has an interactive mode that simplifies your OCI CLI user experience
|
|
||||||
with several new features, including command and parameter suggestions,
|
|
||||||
auto-completion, and command reference information.
|
|
||||||
|
|
||||||
In interactive mode, suggestions will be made as you navigate the command line.
|
|
||||||
For example, it can help find the right arguments for a command, and fill in
|
|
||||||
ocids by allowing you to search based on display names.
|
|
||||||
|
|
||||||
An example of a command you can run is oci iam availablity-domain list.
|
|
||||||
|
|
||||||
To try that now, and go into interactive mode, type oci -i and then hit Return.
|
|
||||||
|
|
||||||
And then try the following:
|
|
||||||
|
|
||||||
1. Type in iam and then a space. The CLI will give you a list of choices.
|
|
||||||
2. Type avail and then hit tab to autocomplete the command
|
|
||||||
3. Type a space and then list and then hit return to finish the command
|
|
||||||
|
|
||||||
|
|
||||||
Type oci -i to go into interactive mode:
|
|
||||||
$ oci -i
|
|
||||||
Learn more about interactive features in CLI by watching our informative video
|
|
||||||
on YouTube
|
|
||||||
-> https://www.youtube.com/watch?v=lX29Xw1Te54&ab_channel=OracleLearning
|
|
||||||
Also see
|
|
||||||
https://docs.oracle.com/iaas/Content/API/SDKDocs/cliusing_topic-Using_Interactive_Mode.htm
|
|
||||||
> oci
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using Docker
|
|
||||||
|
|
||||||
```txt
|
|
||||||
You can use Docker from within Cloud Shell to develop software.
|
|
||||||
|
|
||||||
Hit return to docker run hello-world:
|
|
||||||
|
|
||||||
$ docker run hello-world
|
|
||||||
|
|
||||||
Hello from Docker!
|
|
||||||
This message shows that your installation appears to be working correctly.
|
|
||||||
|
|
||||||
To generate this message, Docker took the following steps:
|
|
||||||
1. The Docker client contacted the Docker daemon.
|
|
||||||
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
|
|
||||||
(amd64)
|
|
||||||
3. The Docker daemon created a new container from that image which runs the
|
|
||||||
executable that produces the output you are currently reading.
|
|
||||||
4. The Docker daemon streamed that output to the Docker client, which sent it
|
|
||||||
to your terminal.
|
|
||||||
|
|
||||||
To try something more ambitious, you can run an Ubuntu container with:
|
|
||||||
$ docker run -it ubuntu bash
|
|
||||||
|
|
||||||
Share images, automate workflows, and more with a free Docker ID:
|
|
||||||
https://hub.docker.com/
|
|
||||||
|
|
||||||
For more examples and ideas, visit:
|
|
||||||
https://docs.docker.com/get-started/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Supported Programming Languages
|
|
||||||
|
|
||||||
```txt
|
|
||||||
We support the following programming languages in Cloud Shell so you can write
|
|
||||||
your own applications:
|
|
||||||
|
|
||||||
* Java including multiple versions of Oracle Java as well as
|
|
||||||
GraalVM Enterprise JDK 17
|
|
||||||
* Python (2 and 3)
|
|
||||||
* Ruby
|
|
||||||
* Golang
|
|
||||||
* JavaScript/NodeJS
|
|
||||||
* C/C++ using gcc
|
|
||||||
* sh and bash scripts
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using the OCI Software Development Kits (SDKs)
|
|
||||||
|
|
||||||
```txt
|
|
||||||
The OCI Software Development Kits (SDKs) allow you to build and deploy apps that
|
|
||||||
integrate with Oracle Cloud Infrastructure services. Each SDK provides the tools
|
|
||||||
you need to develop an app, including code samples and documentation to create,
|
|
||||||
test, and troubleshoot. In addition, if you want to contribute to the development
|
|
||||||
of the SDKs, they are all open source and available on GitHub.
|
|
||||||
|
|
||||||
Cloud Shell installs and updates the version of the OCI SDKs on a regular basis.
|
|
||||||
This means you are always using recent versions of our tools. We also
|
|
||||||
automatically configure your credentials when you launch the Cloud Shell so you
|
|
||||||
do not have to set up keys if you use the default authentication provider.
|
|
||||||
|
|
||||||
To get up and running quickly, you can look at the SDK Cloud Shell Quick Starts
|
|
||||||
for each of the languages:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/Concepts/developerquickstarts.htm
|
|
||||||
|
|
||||||
|
|
||||||
You can also find source and examples on GitHub for the SDKs.
|
|
||||||
* Java: https://github.com/oracle/oci-java-sdk
|
|
||||||
* Python: https://github.com/oracle/oci-python-sdk
|
|
||||||
* Typescript/JavaScript: https://github.com/oracle/oci-typescript-sdk
|
|
||||||
* .NET: https://github.com/oracle/oci-dotnet-sdk
|
|
||||||
* Go: https://github.com/oracle/oci-go-sdk
|
|
||||||
* Ruby: https://github.com/oracle/oci-ruby-sdk
|
|
||||||
```
|
|
||||||
|
|
||||||
### Code Editor
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Cloud Shell integrates seamlessly with the OCI Code Editor, allowing you to edit
|
|
||||||
code, modify scripts, and update service workflows directly from the OCI Console.
|
|
||||||
|
|
||||||
The Code Editor lets you browse, view, and edit files in your Cloud Shell home
|
|
||||||
directory and provides a convenient way to perform common code updates for
|
|
||||||
various services, including creating and deploying Functions, editing Terraform
|
|
||||||
configurations used with Resource Manager stacks, and creating and editing an API.
|
|
||||||
It offers the following capabilities that enhance your productivity:
|
|
||||||
|
|
||||||
* Built-in integration with OCI services, including Functions,
|
|
||||||
Resource Manager, and Data Science
|
|
||||||
* Access to Cloud Shell and 30+ cloud-based tools
|
|
||||||
* Git integration and workspace management
|
|
||||||
* Rich language support
|
|
||||||
* Session continuity
|
|
||||||
* Personalized user experience
|
|
||||||
|
|
||||||
You can access this from the View menu in the Cloud Shell window or directly from
|
|
||||||
the Developer Tools icon in the Console header.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuring Java Versions
|
|
||||||
|
|
||||||
```txt
|
|
||||||
You can use csruntimectl to configure your version of Java.
|
|
||||||
|
|
||||||
To see the set of available Java versions see `csruntimectl java list`.
|
|
||||||
Your current JDK is indicated by an *.
|
|
||||||
Hit return to list the JDKs available on this system:
|
|
||||||
|
|
||||||
$ csruntimectl java list
|
|
||||||
graalvmeejdk-17 /usr/lib64/graalvm/graalvm22-ee-java17
|
|
||||||
* oraclejdk-11 /usr/java/jdk-11.0.17
|
|
||||||
oraclejdk-1.8 /usr/lib/jvm/jdk-1.8-oracle-x64
|
|
||||||
|
|
||||||
|
|
||||||
You can then set the JDK version by using the command
|
|
||||||
`csruntimectl java set <version from above>`
|
|
||||||
|
|
||||||
Hit return to show your current JAVA_HOME:
|
|
||||||
|
|
||||||
$ echo $JAVA_HOME
|
|
||||||
/usr/lib64/graalvm/graalvm22-ee-java17
|
|
||||||
```
|
|
||||||
|
|
||||||
### Transferring Files to and from your Cloud Shell
|
|
||||||
|
|
||||||
```txt
|
|
||||||
In addition to creating new files and scripts, you can upload files to and
|
|
||||||
download files from your Cloud Shell.
|
|
||||||
|
|
||||||
Under the tools (aka gear) icon on the top right corner of the Cloud Shell header
|
|
||||||
are three options related to File Upload/Download:
|
|
||||||
|
|
||||||
* Download - allows you to transfer files from your Cloud Shell to your local
|
|
||||||
computer
|
|
||||||
* Upload - allows you to transfer files from to Cloud Shell from your local
|
|
||||||
computer
|
|
||||||
* File Transfers - allows you to view active and completed Uploads and
|
|
||||||
Downloads
|
|
||||||
|
|
||||||
To Upload files, you can either drag an drop files into the upload dialog (or
|
|
||||||
even directly into Cloud Shell) or use the file selection dialog to select
|
|
||||||
individual files.
|
|
||||||
|
|
||||||
Try dragging a file into the Cloud Shell window to try to upload now.
|
|
||||||
|
|
||||||
To Download files, you will have to enter the path starting at your home
|
|
||||||
directory in the dialog box. For example, if your file was in ~/temp/myfile you
|
|
||||||
would enter temp/myfile.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Understanding Regions
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Your Cloud Shell host (and your home directory) live in the Home Region for your
|
|
||||||
tenancy regardless of what region is selected in the region pull-down menu in the
|
|
||||||
top right corner of the console. This allows your home directory to be available
|
|
||||||
no matter what region you are operating in.
|
|
||||||
|
|
||||||
Your current region (the region you have selected in the pull-down) is used when
|
|
||||||
accessing tenancy resources using the OCI Command Line Interface (CLI) or the OCI
|
|
||||||
Software Development Kits (SDKs).
|
|
||||||
|
|
||||||
In the current Cloud Shell Session:
|
|
||||||
|
|
||||||
* Your Home region is us-phoenix-1
|
|
||||||
* Your Console selected region is us-phoenix-1
|
|
||||||
|
|
||||||
|
|
||||||
Note: The region used by the SDKs/CLIs is "sticky" based on what was selected in
|
|
||||||
the console when your Cloud Shell was opened and persists as long as the session
|
|
||||||
exists. You can identify what region is active by looking at the Cloud Shell
|
|
||||||
prompt. It will look like:
|
|
||||||
|
|
||||||
<username>@cloudshell:<directory> (<region>)
|
|
||||||
|
|
||||||
If you want to change your region for the CLI/SDK:
|
|
||||||
|
|
||||||
* Select a new region in the Console region pull-down menu, near the top of
|
|
||||||
the Console.
|
|
||||||
* Close and reopen your terminal.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Understanding Network Access from your Cloud Shell
|
|
||||||
|
|
||||||
```txt
|
|
||||||
By default, your Cloud Shell uses our Public Network which is provisioned with
|
|
||||||
both a Service Gateway and additionally has egress to the internet. From your
|
|
||||||
Cloud Shell Public Network connection, you can run OCI CLI commands to access
|
|
||||||
tenancy resources and also reach public resources. The access to public resources
|
|
||||||
allows you to perform tasks like using ssh to access public instances, managing
|
|
||||||
public OKE Clusters and pulling from public git repositories.
|
|
||||||
|
|
||||||
If you would like to access resources which do not have a public IP, you can
|
|
||||||
instead use a Private Network Connection. Using Private Network Access, you can
|
|
||||||
connect to a subnet (assuming your administrator has granted you permission) that
|
|
||||||
lives in your home region.
|
|
||||||
|
|
||||||
See:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro.htm#Cloud_Shell_Private_Access
|
|
||||||
|
|
||||||
Note: No ingress to your Cloud Shell Hosts (in either public or private networks)
|
|
||||||
is supported.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Getting More Information
|
|
||||||
|
|
||||||
```txt
|
|
||||||
You can find out more about Cloud Shell, the CLI and the SDKs here:
|
|
||||||
|
|
||||||
* Cloud Shell Overview:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/Concepts/cloudshellintro.htm
|
|
||||||
* OCI CLI Overview:
|
|
||||||
https://docs.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm
|
|
||||||
* OCI Interactive CLI Overview:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliusing_topic-Using_Interactive_Mode.htm
|
|
||||||
* OCI SDKs Guides:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdks.htm
|
|
||||||
* OCI SDKs Cloud Shell Quickstarts:
|
|
||||||
https://docs.oracle.com/en-us/iaas/Content/API/Concepts/developerquickstarts.htm
|
|
||||||
* Oracle Cloud Infrastructure CLI Command Reference:
|
|
||||||
https://docs.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/
|
|
||||||
```
|
|
||||||
|
|
||||||
```txt
|
|
||||||
Thank you for running our tutorial, and welcome to Cloud Shell!
|
|
||||||
```
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Official Docs
|
|
||||||
|
|
||||||
- [Video](https://youtu.be/JBkT44FSf0o) introducción OCI -
|
|
||||||
[Docs](https://docs.oracle.com/es-ww/iaas/Content/GSG/Concepts/baremetalintro.htm)
|
|
||||||
|
|
||||||
- Video [Compartments](https://youtu.be/VJD19vyu6lI) -
|
|
||||||
[Docs](https://docs.oracle.com/es-ww/iaas/Content/Identity/compartments/managingcompartments.htm)
|
|
||||||
|
|
||||||
- Video Identity & Access [Management](https://youtu.be/8qaQuoJZYvQ) -
|
|
||||||
[Docs](https://docs.oracle.com/es-ww/iaas/Content/Identity/iam/manage-iam.htm)
|
|
||||||
|
|
||||||
- Playlist
|
|
||||||
[Networking](https://www.youtube.com/playlist?list=PLvlciYga5j3z7biGjV7-fywS-xEJ3W6Pp) -
|
|
||||||
[Docs](https://docs.oracle.com/es-ww/iaas/Content/Network/Concepts/landing.htm#top)
|
|
||||||
|
|
||||||
![IAM_diagram](./imgs/IAM_service.png)
|
|
||||||
|
|
||||||
- Playlist
|
|
||||||
[Compute](https://www.youtube.com/playlist?list=PLKCk3OyNwIzsAjIaUaVsKdXcfBOy6LASv) -
|
|
||||||
[Docs](https://docs.oracle.com/es-ww/iaas/Content/home.htm)
|
|
||||||
|
|
||||||
## Oracle Linux 9
|
|
||||||
|
|
||||||
Luego de crear la instancia, y una llave pública
|
|
||||||
|
|
||||||
### Instalación paquete httpd
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo yum -y install httpd
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuración de Firewall
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo firewall-cmd --permanent --add-port=80/tcp
|
|
||||||
sudo firewall-cmd --reload
|
|
||||||
```
|
|
||||||
|
|
||||||
### Iniciar servicio httpd
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo systemctl start httpd
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cambiar a usuario root
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo su
|
|
||||||
```
|
|
||||||
|
|
||||||
### HTML básico
|
|
||||||
|
|
||||||
`/var/www/html/index.html`
|
|
||||||
|
|
||||||
```html
|
|
||||||
<h1>TEST HTML</h1>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Edit Default Security List for VCN
|
|
||||||
|
|
||||||
![http_rules](./imgs/httpd_rules.png)
|
|
||||||
|
|
||||||
### Crear otra instancia para usar load balancer
|
|
||||||
|
|
||||||
Se crea una identica a la anterior (free tier)
|
|
||||||
|
|
||||||
### Load Balancer
|
|
||||||
|
|
||||||
![load_balancer](./imgs/load_balancer.png)
|
|
||||||
|
|
||||||
![test_lb1](./imgs/test_lb1.png)
|
|
||||||
|
|
||||||
![test_lb2](./imgs/test_lb2.png)
|
|
||||||
|
|
||||||
- Video [Load Balancer](https://www.youtube.com/watch?v=tY2UuVbDElc) -
|
|
||||||
Docs [OCI](https://docs.oracle.com/es-ww/iaas/Content/home.htm)
|
|
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 197 KiB |
Before Width: | Height: | Size: 291 KiB |
Before Width: | Height: | Size: 232 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 66 KiB |
@ -1,20 +0,0 @@
|
|||||||
# DevOps
|
|
||||||
|
|
||||||
[Formación](https://app.aluracursos.com/formacion-devops)
|
|
||||||
|
|
||||||
- Git y Github
|
|
||||||
- [Intro](../005_Git_y_github/README.md) Git
|
|
||||||
- Trabajo [Colaborativo](.../005_Git_y_github/colab.md)
|
|
||||||
- [Video](https://www.youtube.com/watch?v=-LmFK6skG7s&t=3s) Git y Github
|
|
||||||
- Linux
|
|
||||||
- []()
|
|
||||||
- []()
|
|
||||||
- Artículo
|
|
||||||
[tar](https://www.aluracursos.com/blog/Linux-comprimiendo-y-descomprimiendo-archivos-con-el-tar)
|
|
||||||
- Artículo
|
|
||||||
[rutas y directorios](https://www.aluracursos.com/blog/trabajando-con-caminos-y-carpetas-en-el-terminal)
|
|
||||||
- Redes
|
|
||||||
- []()
|
|
||||||
- []()
|
|
||||||
- Artículo
|
|
||||||
[Telnet y SSH](https://www.aluracursos.com/blog/ssh-telnet-y-las-diferencias-para-conectar-en-un-servidor)
|
|
14
README.md
@ -59,19 +59,5 @@ primoridiales en programación con Javascript
|
|||||||
### Etapa AlumniONE - Extra
|
### Etapa AlumniONE - Extra
|
||||||
|
|
||||||
- [SQL con MySQL Server de Oracle](./011_mysql/README.md)
|
- [SQL con MySQL Server de Oracle](./011_mysql/README.md)
|
||||||
- Introducción a SQL con [MySQL](./010_spring_boot/base_de_datos.md)
|
|
||||||
- Consultas [SQL](./011_mysql/consultas_sql.md)
|
|
||||||
- DML: Manipulación de [datos con MySQL](./011_mysql/dml.md)
|
|
||||||
- SQL [Procedures](./011_mysql/procedures.md)
|
|
||||||
- Proyecto final [MySQL](./011_mysql/proyecto_mysql.md)
|
|
||||||
- DBA [Seguridad y Optimización](./011_mysql/dba_seguridad_optimiz.md)
|
|
||||||
- [Oracle Cloud Infrastructure](./012_oci/README.md)
|
- [Oracle Cloud Infrastructure](./012_oci/README.md)
|
||||||
- [Python, Data Science en OCI y Oracle Analytics](./013_python_oci/README.md)
|
- [Python, Data Science en OCI y Oracle Analytics](./013_python_oci/README.md)
|
||||||
|
|
||||||
## Formaciónes Adicionales
|
|
||||||
|
|
||||||
### [DevOps](https://app.aluracursos.com/formacion-devops)
|
|
||||||
|
|
||||||
- [Git]()
|
|
||||||
- [Linux]()
|
|
||||||
- [Redes]()
|
|
||||||
|