BTemplates.com

최근 글

이 블로그 검색

Powered by Blogger.

2017년 6월 14일 수요일

Linux top 명령 도움말 보고 따라하기


TOP 명령 도움말 보기

직원중에 top명령을 잘 사용하는 직원이 있어서 배우고 나서, 나름대로 도움말을 보고 정리해 보았습니다. 사용법은 간단합니다. top 명령을 실행한 상태에서 h를 누르면 아래와 같이 top에 대한 도움말 화면이 출력되며 각 항목들을 간단한 키조작으로 수행할수 있습니다.


도움말에서 각 키의 기능을 알아보겠습니다.

1. top 화면에 색상을 입혀보자!!

a/w : a키 또는 w키를 눌려 current window:를 1:Def로 변경합니다. a 키 또는 w키를 누르면 toggle되면서 현재 window가 변경됩니다.



그러고 난 이후에는 Z키를 통해 색상 설정을 하면 됩니다.
Z 키 : Z키는 TOP의 각 패널들의 Color설정을하는  도움말 화면을 출력합니다. top을 실행한 상태에서 Z키를 누르고 나면 color 설정에 대한 도움말이 나타납니다.

친절하게도 실제 top 명령의 각 column에 color를 적용하기 위한 방법에 대한 설명이 순서대로 나타나 있습니다. 1) 2) 3) 순서대로 지시대 에 따라 수행합니다.

1 ) 첫번째로, 색상을 적용할 대상을 선택한다. 영문자로 S/M/H/T중에서 적용하고 싶은 대상을 선택합니다. 현재 적용하는 대상은 "M"이며, 이는 Message/Prompt 항목에 색상을 적용한다는 뜻입니다. S/M/H/T를 누르면 color를 적용할 대상을 선택할수 있습니다. S/M/H/T중 한가지를 눌러 항목을 선택한 이후에 숫자키 0~9까지 눌러보면 해당 항목에 대한 색상이 변경됩니다.

2 ) 두번째로, S/M/H/T키로 타겟을 선택한 이후에는 선택된 Target에 바꿀 색상에 대한 숫자를 입력하여, 색상을 바꿉니다.
색상은 0~7번까지 총 8가지 색상을 선택가능합니다.

추가적으로 이용 가능한 토글 모드는
B : Bold 비활성화/활성화
z : color/mono 활성화/비활성화
b : Task Information 항목에 bold/reverse(선택반전)

모든 항목에 대한 적용이 완료되었으면 <Enter>키를 눌려 적용합니다.















이로써 top 화면의 색상 적용이 끝났습니다. 다음번 top 명령을 실행할때도 해당 적용된 색상 프로파일을 불러오기 위해 대문자 W키를 눌러 저장을 합니다. 해당 파일은 사용자 홈디렉토리에 .toprc 파일로 저장됩니다.

2. Scroll 코디네이터

C 키 : 스크롤 코디네이터로서, C를 누른후 방향키 또는 pageUP/Down으로 top 화면에서 이동 가능합니다.






3. x키로 정렬 필드 선택후 정렬 및 Bold/반전

1 ) x키를 누르면 정렬할 필드가 선택 반전됩니다.

2 ) 선택된 필드에서 < 키 와 >키를 눌러서 선택할 필드를 정합니다.

3 ) 선택한 필드 기준으로 R 키를 누르면 정렬이 됩니다. 현재 기준으로 %CPU 필드가 선택된 상태에서 R 키를 누르면 CPU 사용률 기준으로 프로세스를 정렬합니다.























x키 : 정렬할 필드를 선택/선택해제합니다.

y 키 : running 중인 프로세스를 Bold(진하게)/선택반전 표시할지를 결정합니다.

5. 메모리 표시 용량 바꾸기 KB/MB/GB/TB/PB

1 ) e키 : e키를 누르면 VIRT/RES/SHR 메모리 관련 필드의 용량 표시 단위가 변경됩니다.














2 ) E키 : Mem Swap 관련 필드의 메모리사용률 표시 단위가 변경됩니다.





6. CPU/Mem 관련 표시 화면 바꾸기

t키 :  t키를 누를때마다 CPU관련 표시 화면을 바꿀수 있습니다.
m키 :  m키를 누를때마다 MEM관련 표시 화면을 바꿀수 있습니다.









7. 기타 유용한 토글 기능들.

CPU IDLE 상태가 아닌 프로세스만 표시하기 또는 전체 프로세스 표시하기


COMMAND 필드에 전체 command args 모두 표시하기















2017년 4월 14일 금요일


부록 A. SSL/TLS 인증서 구성


public endpoint를 통한 통신에 SSL/TLS를 사용하도록 Undercloud를 구성 할 수 있습니다. 그러나, 자체 인증 기관으로 SSL 인증서를 사용하는경우, 그 인증서는 다음 장에서 구성 단계가 필요합니다.
NOTE
overcloud SSL/TLS 인증서 생성을 위해, Advanced Overcloud Customization guide에 "Enabling SSL/TLS on the Overcloud"를 참조하십시오.

A.1. 서명 호스트 초기화하기

서명 호스트는 새 인증서를 생성하고 CA(certificate authority)로 그 인증서를 서명하는 호스트입니다. 선택한 서명 호스트에서 SSL 인증서를 생성한 적이 없는 경우, 서명 호스트가 새 인증서를 서명할수 있도록 호스트를 초기화할 필요가 있습니다.
/etc/pki/CA/index.txt 파일은 모든 서명된 인증서레코드들이 저장됩니다.이 파일이 존재하는지 확인하십시오. 파일이 없다면, 빈파일을 생성하십시오:
$ sudo touch /etc/pki/CA/index.txt
/etc/pki/CA/serial 파일은 서명한 다음 인증서용으로 사용할 다음 시리얼 번호를 식별합니다.이 파일이 없는경우,신규 시작값으로 새 파일을 생성하십시오:
$ sudo echo '1000' > /etc/pki/CA/serial

A.2. 인증기관(CERTIFICATE AUTHORITY) 생성하기

일반적으로 외부 인증 기관을 통해 SSL/TLS 인증서에 서명합니다. 어떤 상황에선, 자가 인증 기관을 사용하는 것이 목표일수 있습니다. 예를들어, 내부-전용-인증기관을 가질 수 있습니다.
예를들어, 인증기관 역할을 수행 할 키와 인증서 쌍을 생성합니다.
$ openssl genrsa -out ca.key.pem 4096
$ openssl req  -key ca.key.pem -new -x509 -days 7300 -extensions v3_ca -out ca.crt.pem
openssl req 명령은 권한에 대한 특정 세부 사항을 묻습니다. 이 세부사항들을 입력합니다.
그러면 ca.crt.pem 이라는 인증 기관 파일이 생성됩니다.

A.3. 인증 기관(CA)를 클라이언트들에 추가하기

SSL/TLS를 사용하여 통신하려는 외부 클라이언트의 경우, Red Hat OpenStack Platform 환경에 접근하려는 각 클라이언트에 인증 기관(CA) 파일을 복사하십시오. Once copied to the client, run the following command on the client to add it to the certificate authority trust bundle:
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/
$ sudo update-ca-trust extract

A.4. SSL/TLS KEY 생성하기

undercloud 또는 overcloud 인증서를 생성하기 위해 사용하는, SSL/TLS 키(server.key.pem)를 생성하기 위해 다음 명령을 실행하십시오.
$ openssl genrsa -out server.key.pem 2048

A.5. SSL/TLS 인증서 서명 요청 만들기

이 단계는 undercloud 또는 overcloud에 대한 인증서 서명 요청(서)를 생성합니다. 사용자정의를 위해 기본 OpenSSL 구성파일을 복사합니다.
사용자가 정의 구성파일을 만들기 위해 기본 OpenSSL 구성 파일을 복사하십시오.
$ cp /etc/pki/tls/openssl.cnf .
복사한 openssl.cnf 파일을 편집하고 director용으로 사용할 SSL 파라미터를 설정하십시오. 다음은 수정할 파라미터들의 종류들의 예를 입니다.
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
countryName = Country Name (2 letter code)
countryName_default = AU
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Queensland
localityName = Locality Name (eg, city)
localityName_default = Brisbane
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = Red Hat
commonName = Common Name
commonName_default = 192.168.0.1
commonName_max = 64

[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
IP.1 = 192.168.0.1
DNS.1 = 192.168.0.1
DNS.2 = instack.localdomain
DNS.3 = vip.localdomain
Set the commonName_default to one of the following:
  • If using an IP address to access over SSL/TLS, use the undercloud_public_vipparameter in undercloud.conf.
  • If using a fully qualified domain name to access over SSL/TLS, use the domain name instead.
Include the same Public API IP address as an IP entry and a DNS entry in thealt_names section. If also using DNS, include the hostname for the server as DNS entries in the same section. For more information about openssl.cnf, run man openssl.cnf.
다음 명령을 실행하여 인증서 서명 요청(server.csr.pem)를 생성합니다:
$ openssl req -config openssl.cnf -key server.key.pem -new -out server.csr.pem
Make sure to include the SSL/TLS key you created in Section A.4, “Creating an SSL/TLS Key” for the -key option.
다음 섹션에서 SSL/TLS 인증서를 생성하기 위해 server.csr.pem 파일을 사용하십시오.

A.6. SSL/TLS 인증서 생성하기

다음 명령은 undercloud 또는 overcloud에 대한 인증서를 생성합니다:
$ openssl ca -config openssl.cnf -extensions v3_req -days 3650 -in server.csr.pem -out server.crt.pem -cert ca.crt.pem -keyfile ca.key.pem
This command uses:
This results in a certificate named server.crt.pem. Use this certificate in conjunction with the SSL/TLS key from Section A.4, “Creating an SSL/TLS Key” to enable SSL/TLS.

A.7. UNDERCLOUD에서 인증서 사용하기

다음 명령을 실행하여 인증서와 키를 결합합니다.
$ cat server.crt.pem server.key.pem > undercloud.pem
undercloud.pem 파일을 생성합니다. undercloud.conf 파일에 udercloud_service_certificate 옵션에 이 파일(undercloud.pem)에 위치를 지정합니다. 이 파일은 HAProxy가 파일을 읽을수 있도록 SELinux context가 필요합니다. 다음 예제를 지침으로 사용합시오.
$ sudo mkdir /etc/pki/instack-certs
$ sudo cp ~/undercloud.pem /etc/pki/instack-certs/.
$ sudo semanage fcontext -a -t etc_t "/etc/pki/instack-certs(/.*)?"
$ sudo restorecon -R /etc/pki/instack-certs
undercloud.conf 파일에 undercloud_service_certificate 옵션에  undercloud.pem파일의 위치를 추가 하십시오. 예를들어:
undercloud_service_certificate = /etc/pki/instack-certs/undercloud.pem
In addition, make sure to add your certificate authority from Section A.2, “Creating a Certificate Authority” to the undercloud’s list of trusted Certificate Authorities so that different services within the undercloud have access to the certificate authority:
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/
$ sudo update-ca-trust extract
Continue installing the undercloud as per the instructions in Section 4.6, “Configuring the Director”.

인증서 관련 개념 정리
http://m.blog.naver.com/nttkak/20130245553

2017년 4월 3일 월요일

레드햇 오픈스택 특징 및 이점


LINUX 플랫폼

Red Hat OpenStack Platform

클라우드 성능 향상에 따른 비즈니스 효율성 증대

고객의 요구 사항이 늘어남에 따라 IT 부서의 민첩한 대응이 요구되고 있습니다. 귀사가 대부분의 IT 조직과 비슷한 상황이라면, IT 인프라를 빠르게 배포하고 확장하기 위해 OpenStack®과 같은 IaaS(서비스로서의 인프라) 프라이빗 클라우드를 모색하고 계실 겁니다. 그렇지만 모든 OpenStack 클라우드가 기업의 운영 환경의 요구에 부응하고 성능, 확장성 및 보안 표준을 충족할 수 있는 것은 아닙니다. 다행히도 Red Hat® OpenStack Platform은 이 모든 요구 사항에 부합할 뿐만 아니라 그 이상의 기능을 제공합니다.

원문 : https://www.redhat.com/ko/technologies/linux-platforms/openstack-platform

레드햇 오픈스택 플랫폼의 특장정을 소개한 페이지이다. 제안서 작업이나, 기타 발표할때 한번 훑어 보는것도 나쁘지 않을것 같다.



오픈스택 인스턴스를 올바르게 구성하기 위한 9가지 팁



In OpenStack jargon, an Instance is a Virtual Machine, the guest workload. It boots from an operating system image, and it is configured with a certain amount of CPU, RAM and disk space, amongst other parameters such as networking or security settings.
In this blog post kindly contributed by Marko Myllynen we’ll explore nine configuration and optimization options that will help you achieve the required performance, reliability and security that you need for your workloads.
Some of the optimizations can be done inside a guest regardless of what has the OpenStack Cloud Administrator enabled in your cloud. However, more advanced options require prior enablement and, possibly, special host capabilities. This means many of the options described here will depend on how the Administrator configured the cloud, or may not be available for some tenants as they are reserved for certain groups. More information about this subject can be found on the Red Hat Documentation Portal and its comprehensive guide on OpenStack Image Service. Similarly, the upstream OpenStack documentation has some extra guidelines available.
The following configurations should be evaluated for any VM running on any OpenStack environment. These changes have no side-effects and are typically safe to enable even if unused
openstack-libvirt-images

1) Image Format: QCOW or RAW?

OpenStack storage configuration is an implementation choice by the Cloud Administrator, often not fully visible to the tenant. Storage configuration may also change over the time without explicit notification by the Administrator, as he/she adds capacity with different specs.
When creating a new instance on OpenStack, it is based on a Glance image. The two most prevalent and recommended image formats are QCOW2 and RAW. QCOW2 images (from QEMU Copy On Write) are typically smaller in size. For instance a server with a 100 GB disk, the size of the image in RAW format, might be only 10 GBs when formatted into QCOW2. Regardless of the format, it is a good idea to process images before uploading them to Glance with virt-sysprep(1) and virt-sparsify(1).
The performance of QCOW2 depends on both the hypervisor kernel and the format version, the latest being QCOW2v3 (sometimes referred to as QCOW3) which has better performance than the earlier QCOW2, almost as good as RAW format. In general we assume RAW has better overall performance despite the operational drawbacks (like the lack of snapshots) or the increase in time it takes to upload or boot (due to its bigger size). Our latest versions of Red Hat OpenStack Platform automatically use the newer QCOW2v3 format (thanks to the recent RHEL versions) and it is possible to check and also convert between RAW and older/newer QCOW2 images with qemu-img(1).
OpenStack instances can either boot from a local image or from a remote volume. That means
  • Image-backed instances benefit significantly by the performance difference between older QCOW2 vs QCOW2v3 vs RAW.
  • Volume-backed instances can be created either from QCOW2 or RAW Glance images. However, as Cinder backends are vendor-specific (Ceph, 3PAR, EMC, etc), they may not use QCOW2 nor RAW. They may have their own mechanisms, like dedup, thin provisioning or copy-on-write. On a particular note, using QCOW2 in Glance with Ceph is not supported (see the ceph documentation and BZ#1383014).
.dashboard
As a general rule of thumb, rarely used images should be stored in Glance as QCOW2, but an image which is used constantly to create new instances (locally stored), or for any volume-backed instances, using RAW should provide better performance despite the sometimes longer initial boot time (except in Ceph-backed systems, thanks to its copy-on-write approach). In the end, any actual recommendation will depend on the OpenStack storage configurations chosen by the Cloud Administrator.

2) Performance Tweaks via Image Extra Properties

Since the Mitaka version, OpenStack allows Nova to automatically optimize certain libvirt and KVM properties on the Compute host to better execute a particular OS in the guest. To provide the guest OS information to Nova, just define the following Glance image properties:
  • os_type=linux # Generic name, like linux or windows
  • os_distro=rhel7.1 # Use osinfo-query os to list supported variants
Additionally, at least for the time being (see BZ#1397120), in order to make sure the newer and more scalable virtio-scsi para-virtualized SCSI controller is used instead of the older virt-blk, the following properties need to be set explicitly:
  • hw_scsi_model=virtio-scsi
  • hw_disk_bus=scsi
All the supported image properties are listed at the Red Hat Documentation portal as well as other CLI optionsflavor-metadata

3) Prepare for Cloud-init

“Cloud-init” 은 파티션/파일시스템 크기 및 SSH키와 같은 기본 사항을 구성하기 위해, 클라우드 인스턴스의 초기화에 사용되는 패키지입니다. 
Ensure that you have installed the cloud-init and cloud-utils-growpart packages in your Glance image, and that the related services will be executed on boot, to allow the execution of “cloud-init” configurations to the OpenStack VM.
In many cases the default configuration is acceptable but there are lots of customization options available, for details please refer to the cloud-init documentation.

4) Enable the QEMU Guest Agent

On Linux hosts, it is recommended to install and enable the QEMU guest agent which allows graceful guest shutdownand (in the future) automatic freezing of guest filesystems when snapshots are requested, which is a necessary operation for consistent backups (see BZ#1385748):
  • yum install qemu-guest-agent
  • systemctl enable qemu-guest-agent
In order to provide the needed virtual devices and use the filesystem freezing functionality when needed, the following properties need to be defined for Glance images (see also BZ#1391992):
  • hw_qemu_guest_agent=yes # Create the needed device to allow the guest agent to run
  • os_require_quiesce=yes # Accept requests to freeze/thaw filesystems

5) Just in case: how to recover from guest failure

Comprehensive instance fault recovery, high availability, and service monitoring requires a layered approach which as a whole is out of scope for this document. In the paragraphs below we show the options that can be applicable purely inside a guest (which can be thought as being the innermost layer). The most frequently used fault recovery mechanisms for an instance are:
  • recovery from kernel crashes
  • recovery from guest hangs (which do not necessarily involve kernel crash/panic)
In the rare case the guest kernel crashes, kexec/kdump will capture a kernel vmcore for further analysis and reboot the guest. In case the vmcore is not wanted, kernel can be instructed to reboot after a kernel crash by setting the panic kernel parameter, for example “panic=1”.
In order to reboot an instance after other unexpected behavior, for example high load over a certain threshold or a complete system lockup without a kernel panic, the watchdog service can be utilized. Other actions than “reboot” can be found here. The following property needs to be defined for Glance images or Nova flavors.
  • hw_watchdog_action=reset
Then, install the watchdog package inside the guest, then configure the watchdog device, and finally, enable the service:
  • yum install watchdog
  • vi /etc/watchdog.conf
  • systemctl enable watchdog
By default watchdog detects kernel crashes and complete system lockups. See the watchdog.conf(5) man page for more information, e.g., how to add guest health-monitoring scripts as part of watchdog functionality checks.

6) Tune the Kernel

The simplest way to tune a Linux node is to use the “tuned” facility. It’s a service which configures dozens of system parameters according to the selected profile, which in the OpenStack case is “virtual-guest”. For NFV workloads, Red Hat provides a set of NFV tuned profiles to simplify the tuning of network-intensive VMs, .
In your Glance image, it is recommended to install the required package, enable the service on boot, and activate the preferred profile. You can do it by editing the image before uploading to Glance, or as part of your cloud-init recipe:
  • yum install tuned
  • systemctl enable tuned
  • tuned-adm profile virtual-guest

7) Improve networking via VirtIO Multiqueuing

Guest kernel virtio drivers are part of the standard RHEL/Linux kernel package and enabled automatically without any further configuration as needed. Windows guests should also use the official virtio drivers for their particular Windows version, greatly improving network and disk IO performance.
However, recent advanced in Network packet processing in the Linux kernel and also in user-space components created a myriad of extra options to tune or bypass the virtio drivers. Below you’ll find an illustration of the virtio device model (from the RHEL Virtualization guide).
Network multiqueuing, or virtio-net multi-queue, is an approach that enables parallel packet processing to scale linearly with the number of available vCPUs of a guest, often providing notable improvement to transfer speeds especially with vhost-user.
Provided that the OpenStack Admin has provisioned the virtualization hosts with supporting components installed (at least OVS 2.5 / DPDK 2.2), this functionality can be enabled by OpenStack Tenant with the following property in those Glance images where we want network multiqueuing:
  • hw_vif_multiqueue_enabled=true
그런 이미지로부터 인스턴스화된 게스트안에, NIC channel 설정은 다음 명령을 사용하여 필요에 따라 확인하고 변경할수 있습니다:
  • ethtool -l eth0 #to see the current number of queues
  • ethtool -L eth0 combined <nr-of-queues> # to set the number of queues. Should match the number of vCPUs
There is an open RFE to implement multi-queue activation by default in the kernel, see BZ#1396578.
virtio qemu

8) 게스트에 대한 기타 튜닝

최소한의 설치 패키지만 포함하고 필요한 서비스만 실행한다. 특히, 모든 시나리에서 필요한 것은 아니지만 irqbalance 서비스를 설치하고 활성화하는것이 좋습니다. 오버헤드가 최소화되고 SR-IOV 설정에서 사용되어야합니다.
Even though implicitly set on KVM, it is a good idea to explicitly add the kernel parameter no_timer_check to prevent issues with timing devices. Enabling persistent DHCP client and disabling zeroconf route in network configuration with PERSISTENT_DHCLIENT=yes and NOZEROCONF=yes, respectively, helps to avoid networking corner case issues.
Guest MTU settings are usually adjusted correctly by default, but having a proper MTU in use on all levels of the stack is crucial to achieve maximum network performance. In environments with 10G (and faster) NICs this typically means the use of Jumbo Frames with MTU up to 9000, taking possible VXLAN encapsulation into account. For further MTU discussion, see the upstream guidelines for MTU or the Red Hat OpenStack Networking Guide.

9) Improving the way you access your instances

Although some purists may consider incompatible running SSH inside truly cloud-native instances, especially in auto-scaling production workloads, most of us will still rely on good old SSH to perform configuration tasks (via Ansible for instance) as well as maintenance and troubleshooting (e.g., to fetch logs after a software failure).
The SSH daemon should avoid DNS lookups to speed up establishing SSH connections. For this, consider using UseDNS no in /etc/ssh/sshd_config and adding OPTIONS=-u0 to /etc/sysconfig/sshd (see sshd_config(5) for details on these). Setting GSSAPIAuthentication no could be considered if Kerberos is not in use. In case instances frequently connect to each other, the ControlPersist / ControlMaster options might be considered as well.
Typically remote SSH access and console access via Horizon are enough for most use cases. During development phase direct console access from the Nova compute host may also be helpful, for this to work enable the serial-getty@ttyS1.service, allow root access via ttyS1 if needed by adding ttyS1 to /etc/securetty, and then access the guest console from the Nova compute with virsh console <instance-id> –devname serial1.console-access

We hope with this blog post you’ve discovered new ways to improve the performance of your OpenStack instances. If you need more information, remember we have tons of documents in our OpenStack Documentation Portal and that we offer the best OpenStack courses of the industry, starting with the free of charge CL010 Introduction to OpenStack Course.