Advertisements

Chuleta


person holding black pen and book near pink ceramic mug
Photo by rawpixel.com on Pexels.com

OCI object storage

https://swiftobjectstorage.<region>.oraclecloud.com/v1/<tenantname>/<containername>

credentials:

username/<generate an authtoken in dashboard or with CLI>

CLI:

oci iam auth-token create --description test --user-id ocid1.user.oc1..aaaaaaaahtqjy2k7qigfpe7u5fb74xttzangq54y36amgazhszd4uzknttva

docker

docker login container-registry.oracle.com

grafana

brew services stop grafana

jdbc to oracle

CDB SID:

jdbc:oracle:thin:@130.61.67.9:1521:ORCLCDB

PDB servicename:

jdbc:oracle:thin:@//130.61.67.9:1521/orclpdb1.localdomain

docker cleaner

docker container stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi -f $(docker images -q)
docker system prune

oci command

oci compute instance list --compartment-id ocid1.compartment.oc1..aaaaaaaaefsgvdfcqutt4p5qhjcyuefz5tbpwj5kdp25gi2uvzwd663go63q --output table --query "data [*].{Region:\"region\", Shape:shape}"'

dowload otn soft with wget

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz

key pairs

openssl genrsa -out mykey.pem (generate key)
ssh-keygen -f private.pem -y > private.pub
puttygen whatever.ppk -O private-openssh -o whatever.pem (ppk to pem)
puttygen keyfile -O private -o keyfile.ppk (pen to ppk)
ssh-keygen -l -E md5 -f file.pub (print fingerprint)
openssl rsa -in privatepem -pubout (print public pem from private pem)

scale autonomous databse

oci db autonomous-database update  --autonomous-database-id ocid1.autonomousdatabase.oc1.eu-frankfurt-1.abtheljrsl2t7czntim5sx2sc4rzznu7cqxji7y52f7zl4qbsff5g3u3ic7q --wait-for-state AVAILABLE --cpu-core-count 1

tcpdump capture

tcpdump -i any -w capture_file -G 60 

k8s dashboard

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/.

create db system from backup

oci db system launch-from-backup --availability-domain IesV:EU-FRANKFURT-1-AD-2 --compartment-id ocid1.compartment.oc1..aaaaaaaabi3huagfrq3lfmqvwkjoz625otxgrzbqte3et73kro5yqps32aoa --hostname restaurada --shape VM.Standard1.1 --subnet-id ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaabba5bdnhyip7ow24tg3dhq5u3ig6kxdtjrv4khzpzajlqvwjbxtq --database-edition ENTERPRISE_EDITION --admin-password ABcd##1234 --backup-id ocid1.dbbackup.oc1.eu-frankfurt-1.abtheljrx4oc4zvh4iidpiygikcji5ys2w6cynud4iv56su6x4rsznkoux5a --backup-tde-password ABcd##1234 --ssh-authorized-keys-file publicKey --cpu-core-count 1 --node-count 1 --initial-data-storage-size-in-gb 256

linux7 fw

sudo firewall-cmd --zone=public --permanent --add-port=1521/tcp
sudo firewall-cmd --reload

iptables nat

sudo iptables -t nat -vnL

oci cli

oci compute instance list --compartment-id ocid1.compartment.oc1..aaaaaaaabi3huagfrq3lfmqvwkjoz625otxgrzbqte3et73kro5yqps32aoa

oci compute instance get --instance-id ocid1.instance.oc1.eu-frankfurt-1.abtheljrc4k32kfkx3eyevi6rmmrnrncqt6qul2w5s4zodfdb6tdklnby2xq

oci compute instance action --action stop  --instance-id ocid1.instance.oc1.eu-frankfurt-1.abtheljrc4k32kfkx3eyevi6rmmrnrncqt6qul2w5s4zodfdb6tdklnby2xq

psm cli

psm jcs delete-service -s pruebaj -d SYS -a Welcome#1 -of json

 

my ip from linux cmd

curl ifconfig.co

get certificates

openssl s_client -connect smtp.gmail.com:465 -showcerts

encrypt

openssl enc -base64 -e -des3 -in prueba.txt -out prueba.enc

openssl enc -base64 -des3 -d -in prueba.enc -out prueba.des.txt

 

keytool -printcert -file <file>

openssl req -nodes -x509 -newkey rsa:2048 -days 3650 -keyout jmuCA.key -out jmuCA.crt

openssl genrsa -out web.key 2048

openssl req -new -key web.key -out web.csr

openssl x509 -CA jmuCA.crt -CAkey jmuCA.key -req -in web.csr -days 3650 -CAcreateserial -sha1 -out web.crt

openssl pkcs12 -export -name web -in web.crt -inkey web.key -out web.p12

( keytool -list -keystore web.p12 -v )

keytool -importcert -alias web -file web.p12 -keystore web.jks -storetype pkcs12 (error)

svc.importKeyStore(appStripe=’OTD’, name=’opc-config’, password=’welcome1′,aliases=’web’, keypasswords=’welcome1′, type=’JKS’, permission=true, filepath=’/u01/app/oracle/tools/home/oracle/web.p12′)

 

allocate bigfile

fallocate -l 1G test.img

crawl a web

wget --no-clobber --convert-links --random-wait -r -p --level 10 -E -e robots=off -U mozilla http://www.intratext.com

 

/etc/rc.local

su – <user> <command>

ssh-keygen -t rsa

jdbc:oracle:thin:@<ip>:<port>:<service> [sys as sysdba ]

change ssh port

apache certificate

export http_proxy=http://<USERNAME>:<PASSOWRD>@<proxy-server>:<port>

 

INTERRUPTS

watch -n5 “cat /proc/interrupts”

xen

xl sched-credit
xl sched-credit -d 0 -w 512
xl vcpu-list
xl vcpu-pin Domain-name1 0 0
xl vcpu-pin Domain-name1 1 1
xl vcpu-pin Domain-name2 all 2-6
xl vcpu-pin 1 all - 16-18
xm sched-credit -d <domain>
xm sched-credit -d <domain> -w <weight>
xm sched-credit -d <domain> -c <cap>

tunning xen:

https://wiki.xen.org/wiki/Tuning_Xen_for_Performance
http://www.oracle.com/technetwork/server-storage/vm/ovm-performance-2995164.pdf

 

numa

xl info -n

http://mokumsolutions.com/oracle-vm-numa-best-practices

https://blogs.oracle.com/wim/entry/understanding_memory_allocation_in_oracle

ovm tunning:

http://www.oracle.com/technetwork/server-storage/vm/ovm-performance-2995164.pdf

https://blogs.oracle.com/jsavit/entry/oracle_vm_performance_and_tuning

REPOS OVM (para instalar “cosas”)

poner en /etc/yum.repos.d los repos de ol6

 

STRESS

[

mkdir /stress_test

cd /stress_test

wget http://people.seas.harvard.edu/~apw/stress/stress-1.0.4.tar.gz

tar –zxvf stress-1.0.4.tar.gz

cd stress-1.0.4

yum install gcc

./configure

make all

src/stress –cpu 1

]

PARSEC

http://parsec.cs.princeton.edu/parsec3-doc.htm

TOP CPU CONSUMER THREAD

get pid: top -H -p <pid>

grab threadid from top processes

convert threadid to hex: hexthid=printf “%x \n” <threadid>

jcmd <pid> Thread.print | grep <hexthid>

GET PID

pgrep  -u   | cut -f 1 -d ” ”

 iptables –table nat –list

vncserver  :1 -geometry 1360×768

BBDD:

ALTER PLUGGABLE DATABASE ALL OPEN READ WRITE;
ALTER SESSION SET container = xxxx;
select instance_name from gv$instance;
select name from gv$services;
select * from gv$pdbs;
yum install oracle-rdbms-server-12cR1-preinstall
ALTER SESSION SET container = xxxx
select /* +  parallel (t, 256)*/ sum (a.n) from mytest.t a, t b where a.n in (select max( n * 3.141592 / 3.141592)from t);
CREATE BIGFILE TABLESPACE T
 DATAFILE
 'T01' SIZE 107374182400 REUSE AUTOEXTEND ON NEXT 100 MAXSIZE 1099511627776
 NOLOGGING
 DEFAULT ROW STORE COMPRESS ADVANCED INMEMORY MEMCOMPRESS FOR CAPACITY HIGH DISTRIBUTE AUTO DUPLICATE ALL PRIORITY CRITICAL
 SEGMENT SPACE MANAGEMENT AUTO
 EXTENT MANAGEMENT LOCAL;alter system set sga_target=1000m scope=both;

SQL> alter system set sga_target=1000m scope=both;

SQL> alter system set sga_max_size=3000m scope=spfile;

LINUX:

find / -type f -size +5000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

ldd

touch --d="2015-12-07 09:00:00"  *

du -a / | sort -n -r | head -n 20
nettui
yum install keepalived
systemctl set-default multi-user.target | graphical.target
printf "username=weblogic\npassword=tolay" >boot.properties

http://public-yum.oracle.com/

ip addr add 192.168.1.50/24 dev eth2
ip link set eth2 up
ip addr del 192.168.1.50/24 eth2
ip link set eth2 down
ip route add 10.10.20.0/24 via 192.168.50.100 dev eth0
ip route del 10.10.20.0/24

Increase filesystem in a Vol:

su -
df -h /tmp
vgdisplay VolGroup
lvextend -L +1024m /dev/mapper/VolGroup-LogVol02
resize2fs /dev/mapper/VolGroup-LogVol02
df -h /tmp

IPSEC:

ipsec auto –add xxx ipsec auto –up xxx tail -f /var/log/secure

WINDOWS:

handle https://technet.microsoft.com/en-us/sysinternals/handle

SOLARIS:

find -exec grep {}\

pkg install --accept solaris-desktop
vncserver [- list | -kill :x ]
svcadm disable
svcs
prsstat
ibswitches
dladm [show-eoib, show-ib, show-phys, show-vnic]
ipadm [show-if, show-addr]
showvnics
showvlan
netadm enable -p ncp defaultfixed
netadm enable -p ncp Automatic
dladm create-vnic -l net0 vnic0
ipadm create-addr -T dhcp net0
pkgadd -d >xxx.pkg
pkg set-publisher -k pkg.oracle.com.key.pem -c pkg.oracle.com.certificate.pem -G "*" -g https://pkg.oracle.com/solarisstudio/release solarisstudio
swap -l
zfs set volsize=2g rpool/swap
prctl -n project.max-shm-memory -v 6gb -r -i project default
netadm enable -p ncp Automatic
zoneadm list -vi
zoneadm -z xxx shutdown
pkg set-publisher -k pkg.oracle.com.key.pem -c pkg.oracle.com.certificate.pem -G "*" -g https://pkg.oracle.com/solarisstudio/release solarisstudio
ipadm create-ip otdvip0
ipadm create-addr -T static -a 192.168.1.9/24 otdvip0
mkdir -p /u01/OTD
mkdir -p /u01/OTDInstances
mount -o vers=3 192.168.1.17:/export/soft /u01/OTD
mount -o vers=3 192.168.1.17:/export/config /u01/OTDInstances/
pkg install vrrp

VIRTUALBOX:

Modo promiscuo + nohup snoop -d iface &

APACHE:

ProxyPass / http://otd-vip.ti.uam.es:6001/
ProxyPassReverse / http://otd-vip.ti.uam.es:6001/

OVM:

service ovmm resstart
service ovmcli restart

https://ovmmserver:7002/0vm/console (admin/xxxx)

ZFS:

https://zfsserver:215 (root/xxxx)

WLST

from java.text import SimpleDateFormat

connect('weblogic','xxxxx','t3://server:port')
serverRuntime()
cd('PartitionRuntimes/testpart_p0/ApplicationRuntimes/WebApplication2/WorkManagerRuntimes/default')
for i in range(10000):
 print get('PendingRequests')
 import time
 time.sleep(3)
disconnect()
p=getPath('com.bea:ServerRuntime=testpart_server_1,Name=default,ApplicationRuntime=WebApplication2,Type=WorkManagerRuntime,PartitionRuntime=testpart_p0')
print p

JMAP:

jmap -dump:[live],format=b,file=/dir/fichero (ulimit -f unlimited) jps (lists pids) jstack

./jcmd 23092 JFR.start duration=300s filename=/home/oracle/myrecording1.jfr
./jmap -dump:live,format=b,file=/home/oracle/md1 23092

./jmap -histo:live 23092 > /home/oracle/histo-live

gdb –pid=23092
(gdb) gcore
Saved corefile core.23092
(gdb) detach
Detaching from program: /oracle/jdk1.7.0_76/bin/java, process 23092
(gdb) quit

./jmap -heap:format=b ./java core.23092 > /home/oracle/heap.hprof 2>&1
JMC:
-Dcom.sun.management.jmxremote.port=7091
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder

./jcmd JFR.start duration=60s filename=myrecording.jfr

SUSE enterprise:

sudo -s -u ec2-user /usr/java/jdk1.8.0_101/bin/jcmd 19536 JFR.start duration=60s filename=myrecording.jfr

JFR help:

https://docs.oracle.com/javacomponents/jmc-5-3/jfr-runtime-guide/comline.htm#BABHCDCE

JROCKIT:

./jrcmd   hprofdump filename=
./jrcmd pid start_flightrecording duration=60s filename=myrecording.jfr settings=full
Template Name Description
code Additional settings for enabling more verbose compiler logging.
default Default settings tuned for a very low performance overhead and recommended for always-on production use.
freemem Additional settings for debugging out-of-memory and fragmentation problems.
full Enables collection of all available events for all subsystems. Warning: This has a very high performance overhead.
io Additional settings for enabling more verbose Java I/O logging.
leak Additional settings for debugging memory leaks.
locks Additional settings for enabling more verbose synchronization logging.
memory Additional settings for enabling more verbose GC/memory management logging.
off Disables all events for all subsystems.
profile Recommended settings for creating a profiling recording. They provide a good balance between the amount of information available and the performance overhead introduced.
sample Additional settings for enabling hotspot sampling of code.
semirefs Additional settings for debugging problems with java.lang.ref.Reference objects and its subclasses.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: