Chuyện của sys

DevOps Blog

System Administrator/ System Engineer là làm gì? July 9, 2017

Tùy từng môi trường, tùy công ty, mà chức danh System Administrator (SA) hay System Engineer (SE) sẽ làm những công việc khác nhau, đảm nhiệm nhiều “chức năng” khác nhau, từ việc thay mực máy in, kéo dây điện thoại, chặn truy cập vào trang thiendia.com… cho tới vận hành 1 hệ thống siêu lớn, cung cấp hạ tầng Cloud, quản trị database…

Dạo 1 vòng các trang tuyển dụng, thì đại khái công việc của SA/SE như sau:
Cái này của chuyên hosting

– Quản trị hệ thống máy chủ Web Hosting, Database, Windows, Linux
– Quản trị hệ thống Cloud (VMWare, Xen, Parallels, Virtuozzo)
– Làm việc Backend hỗ trợ cho đội ngũ chăm sóc khách hàng
– Nghiên cứu ứng dụng công nghệ
– Theo dõi, phân tích và xử lý sự cố
– Viết tài liệu triển khai, lập lịch và bảo trì hệ thống

Của 1 công ty Singapore nào đó

– Provide operational and maintenance support for cyber security infrastructure components like SIEM, firewalls, Endpoint systems, intrusion prevention/detection systems, etc.
– Perform corrective actions or routine preventive maintenance tasks, e.g. evaluate, test, and apply critical patches to operating systems, applications, etc.
– Analyzing, correcting and troubleshooting from fault calls remotely and onsite.

Của 1 công ty chuyên về game nào đó

Quản trị vận hành hệ thống game.
Chịu trách nhiệm về khả năng bảo mật, backup, dự phòng của hệ thống.
Chịu trách nhiệm toàn bộ hạ tầng network, servers, ứng dụng cho toàn bộ hệ thống game.
Kết hợp với team sản phẩm design hệ thống game.
Đảm bảo security của hệ thống ở mức tối ưu nhất.

Vậy đề làm được SA/SE thì phải có những kỹ năng, yêu cầu gì?
🙂 Đón xem các bài viết tiếp theo nhé.

No Comments on System Administrator/ System Engineer là làm gì?
Categories: Chuyện nghề

Linux là cái gì?

Việc cần làm đầu tiên của 1 Linux system admin đọc được tiếng Anh và hiểu được Linux là gì?

Từ điện thoại, xe hơi, siêu máy tính cho đến đồ gia dụng, tất cả đều có mặt của hệ điều hành Linux.

Linux. It’s been around since the mid ‘90s, and has since reached a user-base that spans industries and continents. For those in the know, you understand that Linux is actually everywhere. It’s in your phones, in your cars, in your refrigerators, your Roku devices. It runs most of the Internet, the supercomputers making scientific breakthroughs, and the world\’s stock exchanges. But before Linux became the platform to run desktops, servers, and embedded systems across the globe, it was (and still is) one of the most reliable, secure, and worry-free operating systems available.

Vậy nó có giống như Windows XP, Windows 7, Windows 10, MacOS X hay không? Nó bao gồm những thành phần nào? Tại sao lại sử dụng nó?

Just like Windows XP, Windows 7, Windows 8, and Mac OS X, Linux is an operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply – the operating system manages the communication between your software and your hardware.
This is the one question that most people ask. Why bother learning a completely different computing environment, when the operating system that ships with most desktops, laptops, and servers works just fine? To answer that question, I would pose another question. Does that operating system you’re currently using really work “just fine”? Or are you constantly battling viruses, malware, slow downs, crashes, costly repairs, and licensing fees?

Ubuntu, Fedora, Arch … khác nhau như thế nào? tại sao lại lắm chuyện khi đưa ra 1 đống “distro”như thế?

Linux has a number of different versions to suit nearly any type of user. From new users to hard-core users, you’ll find a “flavor” of Linux to match your needs. These versions are called distributions (or, in the short form, “distros.”) Nearly every distribution of Linux can be downloaded for free, burned onto disk (or USB thumb drive), and installed (on as many machines as you like).

Nên dùng RedHat hay Ubuntu cho server của bạn? Cái nào là miễn phí hoàn toàn, cái nào phải trả tiền để mua gói dịch vụ hỗ trợ?

Which distribution you use will depend upon the answer to three simple questions:

  • How skilled of a computer user are you?
  • Do you prefer a modern or a standard desktop interface?
  • Server or desktop?

Đọc tới đây là bắt đầu rối tinh rối mù rồi, nhưng vẫn phải quyết định “thử” 1 cái nào đó phù hợp với nhu cầu của mình. Nếu như là 1 system admin hoặc muốn trở thành 1 thứ gì đó tương tự, thì hãy bắt đầu ngay và luôn. Hãy cài đặt nó 🙂

For most, the idea of installing an operating system might seem like a very daunting task. Believe it or not, Linux offers one of the easiest installations of all operating systems. In fact, most versions of Linux offer what is called a Live distribution – which means you run the operating system from either a CD/DVD or USB flash drive without making any changes to your hard drive. You get the full functionality without having to commit to the installation. Once you’ve tried it out, and decided you wanted to use it, you simply double-click the “Install” icon and walk through the simple installation wizard.

Tôi chọn Ubuntu 14.04 LTS cho laptop đang sử dụng và Centos, Ubuntu cho hệ thống máy chủ mình đang vận hành.
Tới đây thì chắc bạn cũng đang bận bịu với việc google cách cài đặt 1 hệ điều hành Linux như thế nào? hoặc là đang google dịch để hiểu bài viết trên nói gì, nhưng dù sao, thì cũng chào mừng các bạn đến 1 thế giới mới sau khi gõ “Linux là gì?”
 
 
 

No Comments on Linux là cái gì?
Tags:
Categories: Linh tinh

Install JIRA on Centos 7 October 10, 2016

1. Install JDK 1.7 :
Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html to download.
wget http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
tar -xvzf jdk-7u79-linux-x64.tar.gz
cp -r jdk-7u79-linux-x64 /zserver/jdk1.7.0_79
echo “export JAVA_HOME=/zserver/jdk1.7.0_79” >> /etc/profile
echo “export PATH=$PATH:$JAVA_HOME/bin” >> /etc/profile
Make sure it’s working
java -version
java version “1.7.0_79″
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
2. Install Mariadb and setup database for JIRA
yum install mariadb-*
systemctl start mariadb
ps ax |grep maria
1530 ? Sl 0:00 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin
–log-error=/var/log/mariadb/mariadb.log –pid-file=/var/run/mariadb/mariadb.pid –socket=/var/lib/mysql/mysql.sock
mysqladmin -u root password ‘test123’
mysql -u root -p
MariaDB [(none)]> CREATE DATABASE jira CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON jira.* TO ‘jira’@’127.0.0.1’ identified by ‘test123’;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON jira.* TO ‘jira’@’172.16.74.133’ identified by ‘test123’;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON jira.* TO ‘jira’@’lab1’ identified by ‘test123’;
MariaDB [(none)]> FLUSH PRIVILEGES;
3. Download JIRA 6.2.1
wget http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-6.2.1.zip
unzip atlassian-jira-6.2.1.zip
mv atlassian-jira-6.2.1-standalone /zserver/atlassian-jira
adduser jira
chown -R jira. /zserver/atlassian-jira
su – jira
Change JIRA_HOME in configuration file
cd /zserver/atlassian-jira
vi bin/setenv.sh
JIRA_HOME=”/home/jira/home”
vi atlassian-jira/WEB-INF/classes/jira-application.properties
jira.home = “/home/jira/home”
4. Install JDBC to connect database
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.tar.gz
tar -xvzf mysql-connector-java-5.1.30.tar.gz
cp -r mysql-connector-java-5.1.30/mysql-connector-java-5.1.30-bin.jar /zserver/atlassian-jira/lib/
5. Launch JIRA server with trial version
/zserver/atlassian-jira/bin/start-jira.sh
To run JIRA in the foreground, start the server with start-jira.sh -fg
executing as current user
…..
…. .NMMMD. …
.8MMM. $MMN,..~MMMO.
.?MMM. .MMM?.
OMMMMZ. .,NMMMN~
.IMMMMMM. .NMMMN. .MMMMMN,
,MMMMMM$..3MD..ZMMMMMM.
=NMMMMMM,. .,MMMMMMD.
.MMMMMMMM8MMMMMMM,
.ONMMMMMMMMMMZ.
,NMMMMMMM8.
.:,.$MMMMMMM
.IMMMM..NMMMMMD.
.8MMMMM: :NMMMMN.
.MMMMMM. .MMMMM~.
.MMMMMN .MMMMM?.
Atlassian JIRA
Version : 6.2.1
Detecting JVM PermGen support…
PermGen switch is supported. Setting to 384m
If you encounter issues starting or stopping JIRA, please see the Troubleshooting guide at http://confluence.atlassian.com/display/JIRA/Installation+Troubleshooting+Guide
Using JIRA_HOME: /home/jira/home
Server startup logs are located in /zserver/atlassian-jira/logs/catalina.out
Using CATALINA_BASE: /zserver/atlassian-jira
Using CATALINA_HOME: /zserver/atlassian-jira
Using CATALINA_TMPDIR: /zserver/atlassian-jira/temp
Using JRE_HOME: /zserver/jdk1.7.0_79
Using CLASSPATH: /zserver/atlassian-jira/bin/bootstrap.jar:/zserver/atlassian-jira/bin/tomcat-juli.jar
Using CATALINA_PID: /zserver/atlassian-jira/work/catalina.pid
Check log: tail -f /zserver/atlassian-jira/logs/catalina.out
Oct 10, 2016 5:20:33 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“http-bio-8080”]
Oct 10, 2016 5:20:33 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 24404 ms
netstat -aonp |grep 8080
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::8080 :::* LISTEN 2709/java off (0.00/0/0)
Make to backup
cp -r atlassian-jira atlassian-jira.org
6. Start web base to configuration
http://172.16.74.133:8080/
Very easy to setup
screenshot-from-2016-10-09-212435
Choose My Own Database
screenshot-from-2016-10-09-212654
Input correct information and test connection. After that Click Next
 
 
screenshot-from-2016-10-09-212845
Import Data or config Base URL
screenshot-from-2016-10-09-212915
Add license key to your account
screenshot-from-2016-10-09-213016
Finish your setup
screenshot-from-2016-10-09-213100
First login with custom user.
7.Finish your Installation
====================================Install cracked version with =======================
1. cd Crack location
Download https://drive.google.com/drive/u/1/folders/0B0fYyi16qC6qZ2t5Uk5GWjhvbXc
cp -r atlassian-extras-2.2.2.jar /zserver/atlassian-jira-ent/atlassian-jira/WEB-INF/lib/
cp: overwrite ‘/zserver/atlassian-jira-ent/atlassian-jira/WEB-INF/lib/atlassian-extras-2.2.2.jar’? y
cd /zserver/atlassian-jira-ent/atlassian-jira/WEB-INF/classes
zip -d atlassian-bundled-plugins.zip atlassian-universal-plugin-manager-plugin-2.15.jar
zip -r /zserver/atlassian-jira-ent/atlassian-jira/WEB-INF/classes/atlassian-bundled-plugins.zip atlassian-universal-plugin-manager-plugin-2.10.1.jar
adding: atlassian-universal-plugin-manager-plugin-2.10.1.jar (deflated 11%)
2. Put it in your license
Go to http://172.16.74.133:9090/secure/admin/ViewLicense.jspa
Description=JIRA: Commercial,
CreationDate=2016-10-09,
jira.LicenseEdition=ENTERPRISE,
Evaluation=false,
jira.LicenseTypeName=COMMERCIAL,
jira.active=true,
licenseVersion=2,
MaintenanceExpiryDate=2099-12-31,
Organisation=phamportable,
SEN=SEN-L8642940,
ServerID=B6S1-IPL3-1H8L-DSNX,
jira.NumberOfUsers=-1,
LicenseID=LID-L8642940,
LicenseExpiryDate=2099-12-31,
PurchaseDate=2016-10-09
screenshot-from-2016-10-09-221857
 

No Comments on Install JIRA on Centos 7

[Fixed]omreport not displaying information September 25, 2016

Lỗi:
/opt/dell/srvadmin/sbin/omreport storage pdisk controller=0
Invalid controller value. Read, controller=0
No controllers found.
1: Kiểm tra status của Srvadmin
/opt/dell/srvadmin/sbin/srvadmin-services.sh status
/etc/init.d/instsvcdrv: line 1589: 22532 Segmentation fault      (core dumped) ${ISVCDD_SBIN_DIR}/${ISVCDD_DCHCFG_EXE} command=getsystype > /dev/null 2>&1
dcdbas (module) is running
dell_rbu (module) is running
/etc/init.d/instsvcdrv: line 1589: 22558 Segmentation fault      (core dumped) ${ISVCDD_SBIN_DIR}/${ISVCDD_DCHCFG_EXE} command=getsystype > /dev/null 2>&1
dsm_sa_datamgrd (pid 25349 25247) is running
dsm_sa_eventmgrd (pid 25304) is running
dsm_sa_snmpd (pid 25316) is running
dsm_om_shrsvcd (pid 25361) is running…
dsm_om_connsvcd (pid  25424) is running…
2: Đếm / Liệt kê các process sử dụng semaphores
ipcs -st |wc -l
1028
3: Check /var/log/messages
Jan 26 14:01:36HOSTNAME  Server Administrator (Shared Library): 22930 0 – Data Engine  A semaphore set has to be created but the system limit for the maximum number of semaphore sets has been exceeded
Jan 26 14:01:36 HOSTNAME  Server Administrator (Shared Library): 22930 0 – Data Engine  A semaphore set has to be created but the system limit for the maximum number of semaphore sets has been exceeded
3+: output của OMSM
Broadcast message from root@HOSTNAME  (Tue Jan 26 14:07:47 2016):
OMSM : The current firmware version  21.1.0-0007 is older than the required fir
mware version 21.3.1-0001 for a controller of model 0x1F34:  Controller 0 (PERC
H710P Mini)
Broadcast message from root@HOSTNAME  (Tue Jan 26 14:07:48 2016):
OMSM : Disk found is not supplied by an authorized hardware provider:  Physical
Disk 0:1:8 Controller 0, Connector 0
Broadcast message from root@HOSTNAME (Tue Jan 26 14:07:48 2016):
OMSM : Disk found is not supplied by an authorized hardware provider:  Physical
Disk 0:1:9 Controller 0, Connector 0
Root cause:
1: Do server admin sử dụng Share Library tạo Semaphore Arrays nhưng đã tới giới hạn của kernel.
Nguyên nhân tạo ra Semaphore có thể là do lỗi Segmentation fault (core dumped), hoặc crash lúc restart lại service như nginx, lib C…
Solution:
A: Có thể tăng giới hạn của ipcs lên:
sysctl -w kernel.sem=”250 32000 100 1184″
B: Thực hiện như sau:
1: Chạy script sau để xóa toàn bộ semaphore
cat kill_ipcs.sh

#!/bin/sh
ME=`whoami`
IPCS_S=`ipcs -s | egrep “0x[0-9a-f]+ [0-9]+” | grep $ME | cut -f2 -d” “`
for id in $IPCS_S; do
 ipcrm -s $id;
done

2: Restart lại srvadmin
/opt/dell/srvadmin/sbin/srvadmin-services.sh restart
3: Check lại status
/opt/dell/srvadmin/sbin/omreport storage pdisk controller=0
List of Physical Disks on Controller PERC H710P Mini (Embedded)
Tham khảo:
http://serverfault.com/questions/352026/anyone-know-how-to-fix-issues-with-omsa-on-red-hat-5-1-that-reports-no-controll
http://stackoverflow.com/questions/2143404/delete-all-shared-memory-and-semaphores-on-linux
http://serverfault.com/questions/668151/nginx-orphans-a-semaphore-on-restart-4294967295

No Comments on [Fixed]omreport not displaying information

Install MySQL Master-Slave on Centos June 17, 2016

##lab
172.16.74.129 lab2 master
172.16.74.130 lab3 slave
Install new version mysql from repo on both servers.
Download from http://repo.mysql.com/
##Newest version 5.7: http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm

wget http://repo.mysql.com/mysql-community-release-el6-4.noarch.rpm
yum localinstall mysql-community-release-el6-*.noarch.rpm
yum install mysql-community-server

Initdata to custom datadir on both servers.

[root@lab2 ~]# mkdir -p /data/{mysql1,mysql1_log,mysqlmulti_log}
[root@lab2 ~]# mysql_install_db –user=mysql –datadir=/data/mysql1
Installing MySQL system tables…2016-06-04 20:39:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-04 20:39:26 1422 [Note] InnoDB: The InnoDB memory heap is disabled
2016-06-04 20:39:26 1422 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-04 20:39:26 1422 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-04 20:39:26 1422 [Note] InnoDB: Using Linux native AIO
2016-06-04 20:39:26 1422 [Note] InnoDB: Using CPU crc32 instructions
2016-06-04 20:39:26 1422 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-06-04 20:39:26 1422 [Note] InnoDB: Completed initialization of buffer pool
2016-06-04 20:39:26 1422 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-06-04 20:39:26 1422 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-06-04 20:39:26 1422 [Note] InnoDB: Database physically writes the file full: wait…
2016-06-04 20:39:26 1422 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-06-04 20:39:26 1422 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-06-04 20:39:26 1422 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-06-04 20:39:26 1422 [Warning] InnoDB: New log files created, LSN=45781
2016-06-04 20:39:26 1422 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-06-04 20:39:26 1422 [Note] InnoDB: Doublewrite buffer created
2016-06-04 20:39:26 1422 [Note] InnoDB: 128 rollback segment(s) are active.
2016-06-04 20:39:26 1422 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-06-04 20:39:26 1422 [Note] InnoDB: Foreign key constraint system tables created
2016-06-04 20:39:26 1422 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-06-04 20:39:26 1422 [Note] InnoDB: Tablespace and datafile system tables created.
2016-06-04 20:39:26 1422 [Note] InnoDB: Waiting for purge to start
2016-06-04 20:39:26 1422 [Note] InnoDB: 5.6.14 started; log sequence number 0
2016-06-04 20:39:26 1422 [Note] Binlog end
2016-06-04 20:39:26 1422 [Note] InnoDB: FTS optimize thread exiting.
2016-06-04 20:39:26 1422 [Note] InnoDB: Starting shutdown…
2016-06-04 20:39:28 1422 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables…2016-06-04 20:39:28 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-04 20:39:28 1445 [Note] InnoDB: The InnoDB memory heap is disabled
2016-06-04 20:39:28 1445 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-04 20:39:28 1445 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-04 20:39:28 1445 [Note] InnoDB: Using Linux native AIO
2016-06-04 20:39:28 1445 [Note] InnoDB: Using CPU crc32 instructions
2016-06-04 20:39:28 1445 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-06-04 20:39:28 1445 [Note] InnoDB: Completed initialization of buffer pool
2016-06-04 20:39:28 1445 [Note] InnoDB: Highest supported file format is Barracuda.
2016-06-04 20:39:28 1445 [Note] InnoDB: 128 rollback segment(s) are active.
2016-06-04 20:39:28 1445 [Note] InnoDB: Waiting for purge to start
2016-06-04 20:39:28 1445 [Note] InnoDB: 5.6.14 started; log sequence number 1625977
2016-06-04 20:39:28 1445 [Note] Binlog end
2016-06-04 20:39:28 1445 [Note] InnoDB: FTS optimize thread exiting.
2016-06-04 20:39:28 1445 [Note] InnoDB: Starting shutdown…
2016-06-04 20:39:30 1445 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h lab2 password ‘new-password’
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
The latest information about MySQL is available on the web at
http://www.mysql.com
Please visit
http://bugs.mysql.com/
to report bugs. This database is public and can be browsed
and searched by anyone. If you log in to the system
you can enter new reports.
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
–defaults-file argument to mysqld_safe when starting the server

 

chown -R mysql. /data/

 

Custom configuration
cat /etc/my.cnf
#MYSQL configuration
[mysql]
prompt=mysql:\\u@\\h:\\p/\\d>\\_
[client]
port            = 3306
socket          = /data/mysql1/mysql1.sock
[mysqld_multi]
mysqld=/usr/bin/mysqld_safe
mysqladmin=/usr/bin/mysqladmin
log=/data/mysqlmulti_log/mysqlmulti.log
[mysqld1]
user=mysql
port            = 3306
bind-address    = 172.16.74.129
server-id=1
log-bin=mysql-bin
datadir=/data/mysql1
socket=/data/mysql1/mysql1.sock
pid-file=/data/mysql1/mysql1.pid
log-error=/data/mysql1_log/mysql1-err.log
long_query_time=10
slow_query_log=1
slow_query_log_file=/data/mysql1_log/mysql1-slow.log
general-log = 0
general_log_file = /data/mysql1_log/mysql1.log
character-set-server = utf8
collation-server = utf8_unicode_ci
max_heap_table_size = 768M
tmp_table_size = 768M
open_files_limit = 20480
#table_open_cache  = 10240
#table_definition_cache = 4096
low_priority_updates = 0
concurrent_insert = 2
connect_timeout = 5
interactive_timeout = 600
wait_timeout = 3600
max_allowed_packet = 256M
myisam_sort_buffer_size = 256M
key_buffer_size = 512M
read_buffer_size = 4M
read_rnd_buffer_size = 8M
sort_buffer_size = 16M
join_buffer_size = 32M
max_connections = 600
max_user_connections = 500
max_connect_errors = 999999
thread_cache_size = 128
thread_concurrency = 4
query_cache_size = 128M
query_cache_limit = 32M
query_cache_type = 1
query_cache_min_res_unit = 512
query_prealloc_size = 262144
query_alloc_block_size = 65536
skip_external_locking
skip-name-resolve
bulk_insert_buffer_size = 64M
sync_frm = 1

 
Start Server

mysqld_multi start 1

Verify it’s running.

mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is running

##Replication setup

lab2:
mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

GRANT REPLICATION SLAVE ON *.* to ‘repl’@’172.16.74.130’ IDENTIFIED BY ‘sl@vE300516’;
FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0,00 sec)
mysql:root@localhost:mysql1.sock/(none)>  SHOW MASTER STATUS;
+——————+———-+————–+——————+——————-+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+——————+———-+————–+——————+——————-+
| mysql-bin.000001 |      532 |              |                  |                   |
+——————+———-+————–+——————+————cre——-+
1 row in set (0,00 sec)
Remeber this value
lab3:
CHANGE MASTER TO MASTER_HOST=’172.16.74.129′, MASTER_USER=’repl’, MASTER_PASSWORD=’sl@vE300516′, MASTER_LOG_FILE=’mysql-bin.000001′, MASTER_LOG_POS=532;
Query OK, 0 rows affected, 2 warnings (0,01 sec)
start slave;
show slave status\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: lab2
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 532
Relay_Log_File: mysql1-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 532
Relay_Log_Space: 120
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: /data/mysql1/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0,00 sec)
lab2:
mysql:root@localhost:mysql1.sock/(none)> UNLOCK TABLES;
Query OK, 0 rows affected (0,00 sec)
mysql:root@localhost:mysql1.sock/(none)> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| performance_schema |
+——————–+
3 rows in set (0,00 sec)
 
 
 
 
 
 

No Comments on Install MySQL Master-Slave on Centos
Categories: Cũ hơn

Install Ruby from source on Centos

Xem thông tin hệ điều hành

cat /etc/redhat-release
CentOS release 6.8 (Final)

Cài các gói phụ thuộc cần thiết

yum -y groupinstall “Development Tools”
yum -y install openssl-devel

Tải bản cài đặt từ trang chủ

wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar -xvzf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure –prefix=/xserver/ruby
make
make install

Check version sau khi cài đặt

/xserver/ruby/bin/ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Update gem

/xserver/ruby/bin/gem update –system
/xserver/ruby/bin/gem update

Check version gem

/xserver/ruby/bin/gem -v
2.6.4

Cài đặt 1 số thư viện cần thiết như redis, redis-copy

/xserver/ruby/bin/gem install redis
/xserver/ruby/bin/gem install redis-copy

Hoàn thành.

No Comments on Install Ruby from source on Centos
Categories: Cũ hơn

MFG/PRO Simple Init script for Tomcat and Progress OpenEdge October 10, 2015

haizz, đã bỏ dỡ qúa lâu, mốc meo hết rồi.

tomcat.init

#!/bin/bash
HOME=/qserver/apache-tomcat-8.0.27/bin
case “$1” in
    start)
# Main startup
echo -n “Starting Apache Tomcat Server: “
$HOME/startup.sh
echo “OK”
;;
    stop)
# Main shutdown
echo -n “Shutdown Apache Tomcat Server: “
$HOME/shutdown.sh
echo “OK”
;;
    reload|restart)
$0 stop
$0 start
;;
    configtest)
$HOME/configtest.sh
;;
*)
echo “Usage: `basename $0` start|stop|restart|reload|configtest”
exit 1
esac
exit 0

oe11.init

#!/bin/bash
DLC=/qserver/oe11/dlc
case “$1” in
    start)
# Main startup
echo -n “Starting Progress Admin Server: “
$DLC/bin/proadsv -start
sleep 1
$DLC/bin/proadsv -query
echo “OK”
;;
    stop)
# Main shutdown
echo -n “Stop Progress Admin Server: “
$DLC/bin/proadsv -stop
echo “OK”
;;
    reload|restart)
$0 stop
$0 start
;;
    status)
$DLC/bin/proadsv -query
;;
*)
echo “Usage: `basename $0` start|stop|restart|reload|status”
exit 1
esac
exit 0
Hope it helps.
No Comments on MFG/PRO Simple Init script for Tomcat and Progress OpenEdge

Install free live stream Sopcast Ubuntu 14.x August 24, 2015

Xem bóng đá trực tiếp bằng Sopcast là 1 phương án hữu hiệu khi bạn không có tivi hoặc truyền hình cáp, nhất là năm nay sẽ không được xem C1 trên VTV nữa.
Bắt đầu thôi 😀
Trước hết cài 2 gói này:

sudo apt-get install python-glade2 vlc

Add ppa để cài đặt:

sudo add-apt-repository ppa:venerix/pkg

sudo apt-get update

sudo apt-get install sp-auth

Tải bản cài đặt mới nhất

cd /opt/

sudo wget http://sopcast-player.googlecode.com/files/sopcast-player-0.8.5.tar.gz

sudo tar -xvzf sopcast-player-0.8.5.tar.gz

Build software:

cd sopcast-player/
sudo make && make install

Sau đó mở Sopcast và enjoy!!!

No Comments on Install free live stream Sopcast Ubuntu 14.x
Categories: Cũ hơn

Parallel Rsync for multi hosts July 23, 2015

Như bài viết trước đã đề cập, PSSH Tools cung cấp cho bạn nhiều công cụ như pssh, pscp…ngoài ra prsync cũng là 1 công cụ khá hữu ích cho việc rsync cùng lúc với nhiều hosts.
Xem thêm rsync
Bạn có file txt lưu lại các host như sau:

vi hosts.txt
192.168.6.128
192.168.6.129
Bạn muốn rsync thư mục có tên là Empty lên 2 server trên, cách thông thường thực hiện như sau:
nhanpt5@nhanpt5-X230:~$ while read ip;do rsync -av Empty root@$ip:/root/Empty ;done < hosts.txt
sending incremental file list
Empty/
sent 72 bytes  received 19 bytes  60.67 bytes/sec
total size is 0  speedup is 0.00
sending incremental file list
Empty/
sent 72 bytes  received 19 bytes  60.67 bytes/sec

total size is 0  speedup is 0.00

//comment: Thay vì bạn dùng vòng lặp để thực hiện n lệnh rsync với n host khác nhau thì bạn có thể dùng parallel rsync để thực hiện rsync với n luồng dành cho n host, với việc thực hiện với 1 số lượng lớn hosts thì prsync đem lại hiệu qủa tối đa về tốc độ cũng như hiệu suất.??
nhanpt5@nhanpt5-X230:~$ prsync -av -h hosts.txt -l root server_infos /root/server_infos

[1] 21:20:37 [SUCCESS] 192.168.6.128

[2] 21:20:37 [SUCCESS] 192.168.6.129

Kết quả thu được sẽ giúp bạn xác nhận là việc rsync đã thành công.
Phụ lục: Trước khi thực hiện rsync thì bạn phải cài đặt rsync trên toàn bộ hosts của bạn. Cài đặt bằng pssh như sau:

nhanpt5@nhanpt5-X230:~$ pssh -i -H “192.168.6.128 192.168.6.129” -l root “yum install -y rsync”
[1] 21:20:16 [SUCCESS] 192.168.6.129
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror-fpt-telecom.fpt.net
 * extras: mirror.pregi.net
 * updates: ossm.utm.my
Resolving Dependencies
–> Running transaction check
—> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 rsync           x86_64           3.0.6-12.el6             base           335 k
Transaction Summary
================================================================================
Install       1 Package(s)
[2] 21:20:20 [SUCCESS] 192.168.6.128
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.digipower.vn
 * extras: virror.hanoilug.org
 * updates: mirrors.vonline.vn
Resolving Dependencies
–> Running transaction check
—> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 rsync           x86_64           3.0.6-12.el6             base           335 k
Transaction Summary
================================================================================
Install       1 Package(s)
No Comments on Parallel Rsync for multi hosts
Categories: Cũ hơn

Giới thiệu Parallel SSH (PSSH Tools) July 22, 2015


Khi bạn muốn thực hiện 1 lệnh hoặc 1 vài câu lệnh thông qua SSH cho nhiều hosts cùng 1 lúc kiểu như thế này:

for server in list; do
ssh user@server "command"
done

Bạn sẽ gặp nhiều trở ngại cho việc ssh vào nhiều server cùng 1 lúc và không kiểm soát được những output trả về từ phía server trả về sau khi thực hiện các command. Hoặc bạn muốn deploy 1 dịch vụ nào đó cho toàn bộ server trong hệ thống của bạn nhưng không có 1 tool nào hỗ trợ như salt hay puppet.
Biện pháp nào dành cho bạn trong trường hợp này?

PSSH là công cụ cung cấp phiên bản parallel (song song) của OpenSSH, bao gồm pssh, pscp, prsync, pnuke, pslurp…Mã nguồn được viết bằng Python hỗ trợ từ Python 2,4 trở lên, được viết chính bởi Brent N. Chun.
Project tại đây: http://code.google.com/p/parallel-ssh
pssh được định nghĩa trong pssh(1) linux man page

pssh is a program for executing ssh in parallel on a number of hosts. It provides features such as sending input to all of the processes, passing a password to ssh, saving output to files, and timing out.

Cú pháp của nó cũng hết sức đơn giản và dễ hiểu :

Options

-h host_file

–hosts host_file
Read hosts from the given host_file. Lines in the host file are of the form [user@]host[:port] and can include blank lines and comments (lines beginning with “#”). If multiple host files are given (the -h option is used more than once), then pssh behaves as though these files were concatenated together. If a host is specified multiple times, then pssh will connect the given number of times.
-H[user@]host[:port]–host
[user@]host[:port]
-H
“[user@]host[:port] [ [user@]host[:port ] … ]”
–host
“[user@]host[:port] [ [user@]host[:port ] … ]”
Add the given host strings to the list of hosts. This option may be given multiple times, and may be used in conjunction with the -h option.
-l user
–useruser
Use the given username as the default for any host entries that don’t specifically specify a user.
-p parallelism
–par parallelism
Use the given number as the maximum number of concurrent connections.
-t timeout
–timeout timeout
Make connections time out after the given number of seconds. With a value of 0, pssh will not timeout any connections.
-o outdir
–outdir outdir
Save standard output to files in the given directory. Filenames are of the form [user@]host[:port][.num] where the user and port are only included for hosts that explicitly specify them. The number is a counter that is incremented each time for hosts that are specified more than once.
-e errdir
–errdir errdir
Save standard error to files in the given directory. Filenames are of the same form as with the -o option.
-x args
–extra-args args
Passes extra SSH command-line arguments (see the ssh(1) man page for more information about SSH arguments). This option may be specified multiple times. The arguments are processed to split on whitespace, protect text within quotes, and escape with backslashes. To pass arguments without such processing, use the -X option instead.
-X arg
–extra-arg arg
Passes a single SSH command-line argument (see the ssh(1) man page for more information about SSH arguments). Unlike the -x option, no processing is performed on the argument, including word splitting. To pass multiple command-line arguments, use the option once for each argument.
-O options
–options options
SSH options in the format used in the SSH configuration file (see the ssh_config(5) man page for more information). This option may be specified multiple times.
-A
–askpass
Prompt for a password and pass it to ssh. The password may be used for either to unlock a key or for password authentication. The password is transferred in a fairly secure manner (e.g., it will not show up in argument lists). However, be aware that a root user on your system could potentially intercept the password.
-i
–inline
Display standard output and standard error as each host completes.
–inline-stdout
Display standard output (but not standard error) as each host completes.
-v
–verbose
Include error messages from ssh with the -i and \ options.
-I
–send-input
Read input and send to each ssh process. Since ssh allows a command script to be sent on standard input, the -I option may be used in lieu of the command argument.
-P
–print
Display output as it arrives. This option is of limited usefulness because output from different hosts are interleaved.

Sau khi đọc document xong, việc đầu tiên cần làm là cài đặt nó 😀
Nếu bạn đã cài đặt pip, thì mọi chuyện đơn giản chỉ là command: sudo -E pip install pssh

nhanpt5@nhanpt5-X230:~$ sudo -E pip install pssh
[sudo] password for nhanpt5:
Downloading/unpacking pssh
Downloading pssh-2.3.1.tar.gz
Running setup.py (path:/tmp/pip_build_root/pssh/setup.py) egg_info for package pssh
Installing collected packages: pssh
Running setup.py install for pssh
changing mode of build/scripts-2.7/pssh from 644 to 755
changing mode of build/scripts-2.7/pnuke from 644 to 755
changing mode of build/scripts-2.7/prsync from 644 to 755
changing mode of build/scripts-2.7/pslurp from 644 to 755
changing mode of build/scripts-2.7/pscp from 644 to 755
changing mode of build/scripts-2.7/pssh-askpass from 644 to 755
changing mode of /usr/local/bin/pscp to 755
changing mode of /usr/local/bin/pssh-askpass to 755
changing mode of /usr/local/bin/pslurp to 755
changing mode of /usr/local/bin/prsync to 755
changing mode of /usr/local/bin/pssh to 755
changing mode of /usr/local/bin/pnuke to 755
Successfully installed pssh
Cleaning up…

Ngoài ra bạn có thể download bản cài đặt tại https://code.google.com/p/parallel-ssh/downloads/list

sudo wget http://code.google.com/p/parallel-ssh/downloads/detail?name=pssh-2.3.1.tar.gz
–2015-07-22 22:47:23–  http://code.google.com/p/parallel-ssh/downloads/detail?name=pssh-2.3.1.tar.gz
Resolving code.google.com (code.google.com)… 42.117.10.50, 42.117.10.59, 42.117.10.40, …
Connecting to code.google.com (code.google.com)|42.117.10.50|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/html]
Saving to: ‘detail?name=pssh-2.3.1.tar.gz’
[ <=>                                   ] 10.634      –.-K/s   in 0,002s
2015-07-22 22:47:23 (4,99 MB/s) – ‘detail?name=pssh-2.3.1.tar.gz’ saved [10634]

Giải nén:

tar xvzf pssh-2.3.1.tar.gz

Di chuyển vào thư mục:

cd pssh-2.3.1/

Cài đặt:

sudo python setup.py install

Bắt đầu sử dụng với option cơ bản:
Với 1 host : 192.168.6.128 , command là date

nhanpt5@nhanpt5-X230:~$ pssh -i -H “192.168.6.128” -l root  date
[1] 22:38:59 [SUCCESS] 192.168.6.128
Thứ năm, 23 Tháng bảy năm 2015 05:38:59 ICT

Bạn sẽ thấy kết qủa trả về như trên. Khi gặp lỗi, 1 kết qủa trả về tương tự như sau:

nhanpt5@nhanpt5-X230:~$ pssh -i -H “192.168.6.128” date
[1] 22:38:05 [FAILURE] 192.168.6.128 Exited with error code 255
Stderr: pssh error: SSH requested a password. Please create SSH keys or use
the -A option to provide a password.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Một số Status Code trả về :

Exit Status

The exit status codes from pssh are as follows:

0Success1
Miscellaneous error
2
Syntax or usage error
3
At least one process was killed by a signal or timed out.
4
All processes completed, but at least one ssh process reported an error (exit status 255).
5
There were no ssh errors, but at least one remote command had a non-zero exit status.

Ví dụ: Thực hiện command hostname với 2 host:

nhanpt5@nhanpt5-X230:~$ pssh -i -H “192.168.6.128 192.168.6.129” -l root hostname
[1] 23:06:09 [SUCCESS] 192.168.6.129
sample.test
[2] 23:06:09 [SUCCESS] 192.168.6.128
centos6.local

Như vậy, đã hoàn thành xong phần cơ bản giới thiệu về pssh, bạn có thể thực hiện thêm phần nâng cao và tùy chọn phù hợp tùy vào nhu cầu của mình.

1 Comment on Giới thiệu Parallel SSH (PSSH Tools)
Categories: Cũ hơn Tài liệu