xtrabackup 을 이용한 MySQL 8.0.28 Replication 구성하기

리눅스/MySQL|2022. 7. 28. 09:39
반응형

percona-xtrabackup 패키지는 MySQL 또는 MariaDB 서버의 서비스 중지 없이 Replication 을 구성하기 위한 명령어 입니다.

아래 내용은 CentOS 8 환경에서 MySQL 8.0.28 버전으로 테스트 하였습니다.

사용자 계정이나 패스워드, 디렉토리 등은 사용자 환경에 따라 다르므로 명령 실행시 확인 후 실행하시기 바랍니다.

- master 서버 : 192.168.10.2

- slave 서버 : 192.168.10.3

- 참고1 : xtrabackup 8.0 미만 버전에서는 innobackupex 라는 명령이 있었으나

              xtrabackup 8.0 버전부터 xtrabackup 명령으로 통합되었습니다.

- 참고2 : 설치된 패키지 버전을 자세히 보면 지원하는 DB 버전을 알 수 있습니다.

              percona-xtrabackup-80-8.0.28 은 MySQL 8.0.28 버전까지 백업이 가능합니다.

- 참고3: percona-xtrabackup 패키지는 MySQL 과 MariaDB 둘 다 가능합니다. 다만 설치 버전에 따라 지원가능한 DB 버전이 다르며 MySQL 은 xtrabackup, MariaDB 는 mariabackup 이라는 명령을 사용하는것이 큰 차이점 입니다.

(redo 로그를 기록하는 파일이 다름)

 

- LINK : mariabackup 을 이용한 MariaDB 10.6.9 Replication 구성하기

 

1. 설치

 

(인터넷 연결 가능할 경우)

master 서버와 slave 서버에 xtrabackup 을 설치 합니다.

# yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

# yum -y install percona-xtrabackup-80

 

(인터넷 연결 불가의 경우)

사설망에서 DB를 운영할 경우 서버에 없는 패키지는 설치 파일을 다운 받아 복사하여 설치하면 됩니다.

서버 환경에 따라 필요한 패키지가 다를 수 있으며 이는 아래 rpm 명령으로 의존성 확인이 가능합니다.

 

# wget https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/libev-4.24-6.el8.x86_64.rpm

# wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/perl-DBI-1.641-1.el8.x86_64.rpm

# wget https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64.rpm

# wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/rsync-3.1.3-12.el8.x86_64.rpm

# wget https://repo.percona.com/yum/release/8/RPMS/x86_64/percona-xtrabackup-80-8.0.28-21.1.el8.x86_64.rpm 

 

필요한 패키지를 다운로드 한 후 DB 서버로 옮깁니다. (scp 또는 rsync 등으로 복사하면 됩니다. 방법은 생략)

그리고 아래 순서에 따라 설치합니다.

 

# rpm -ivh libev-4.24-6.el8.x86_64.rpm

# rpm -ivh perl-DBI-1.641-1.el8.x86_64.rpm

# rpm -ivh perl-DBD-MySQL-4.046-3.module_el8.3.0+419+c2dec72b.x86_64.rpm

# rpm -ivh rsync-3.1.3-12.el8.x86_64.rpm

# rpm -ivh percona-xtrabackup-80-8.0.28-21.1.el8.x86_64.rpm

 

2. 원본 데이터 백업

 

(master 서버에서)

# xtrabackup --defaults-file=/etc/my.cnf --user=root --password=12345678 --backup --target-dir=/xtrabackup --no-lock --port=3306 --socket=/tmp/mysql.sock

 

백업이 완료되면 /xtrabackup 디렉토리가 생성되며 하단에 백업 파일들이 존재하게 됩니다.

data 디렉토리 내 파일들과 xtrabackup 관련된 로그가 있습니다.

 

3. 데이터 이전

 

(master 서버에서)

master 서버에 백업된 데이터를 slave 서버로 복사합니다.

# rsync -avzPog /xtrabackup root@192.168.10.3:/

 

4. 데이터 복원

 

(slave 서버에서)

mysqld 데몬을 중지하고 기존 data 디렉토리를 삭제 합니다. (mv 명령으로 디렉토리 이름 변경 권장)

가져온 데이터를 복구하는 과정에서 기존 data 디렉토리내 파일이 있으면 실행이 되지 않기 때문입니다.

 

백업중 작성된 redo 로그를 데이터에 적용합니다.

# xtrabackup --prepare --target-dir=/xtrabackup

 

> --use-memory=10G 와 같이 본 작업에 사용할 시스템 메모리양을 어느정도 할당 해주면 빠른처리가 가능합니다.

> redo 로그 적용 도중에 아래와 같은 에러 메세지가 출력 될 경우 --innodb_force_recovery=1 옵션을 추가 합니다.

2022-10-14  8:47:54 0 [Note] InnoDB: Set innodb_force_recovery=1 to ignore corrupted pages.
2022-10-14  8:47:54 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
[00] FATAL ERROR: 2022-10-14 08:47:54 xtrabackup: innodb_init() returned 11 (Generic error).

하지만 백업 과정에서 문제가 생겼을 수 있으므로 master 서버에서 몇 번 더 백업을 반복 시도해 보는것도 좋습니다.

 

백업 파일을 이동합니다. (--copy-back 를 사용하면 복사)
# xtrabackup --move-back --datadir=/usr/local/mysql/data --target-dir=/xtrabackup

 

root 로 복원하였기 때문에 복원된 파일의 권한이 root 로 되어 있습니다.

mysql 가동을 위해 data 디렉토리의 권한을 설정을 합니다.

# chmod 755 /usr/local/mysql/data
# chown mysql.mysql -R /usr/local/mysql/data

# systemctl start mysqld

 

5. 로그 포지션 설정 및 동기화 시작

 

백업본의 xtrabackup_binlog_info 에 있는 mysql-bin 파일명과 position 값 참고하여
replication 을 적용합니다.

 

(slave 서버에서)

# cat /usr/local/mysql/data/xtrabackup_info |grep binlog_pos

binlog_pos = filename 'binlog.000004', position '156'    // 출력된 내용을 참고

 

# mysql -p

mysql> stop slave;

mysql> reset slave;

mysql> change master to master_host='192.168.10.2', master_user='repl',
master_password='12345678', master_log_file='binlog.000004',
master_log_pos=156;

mysql> start slave;

 

정상적으로 동기화 된 것을 확인할 수 있습니다.

mysql> show slave status \G;

Slave_IO_Running: Yes
Slave_SQL_Running: Yes

 

6. 과정 테스트

 

서비스 사용중 (무정지) 데이터 유실 없이 리플리케이션이 되는지 확인하기 위해 테스트를 진행했습니다.

1) master 서버 테이블에 1,000개의 레코드를 넣은 상태에서

2) 추가로 1,000개의 레코드를 입력하는 스크립트를 가동하고

3) 레코드가 입력되는 중에 xtrabackup 을 수행했습니다.

4) 1,000개의 레코드 입력이 완료되면 (계속 진행되어도 상관없음) slave 로 데이터를 넘겨서

5) --prepare 옵션으로 실행해주면 로그가 데이터에 적용되는것이 백분율로 보였고

6) 그 데이터를 --copy-back 하여 서비스할 위치로 복사하고 replication 포지션을 맞추고 연동하니

7) slave 서버에도 최종 2,000개의 레코드가 확인되었습니다.

 

반응형

댓글()

tcpdump 로 패킷 이동 확인하기

리눅스/Network|2022. 7. 25. 14:56
반응형

서버 운영중 통신 여부를 확인하기 위해 tcpdump 로 패킷 이동 상황을 보게되는 경우가 있습니다.

이경우 아래와 같은 명령으로 간단히 확인이 가능합니다.

 

* 네트워크 장치명 : eno2 일 경우

 

// 나가는 모든 패킷 확인하기

# tcpdump -i eno2

 

// 특정 포트로 확인하기

# tcpdump -i eno2 tcp port 3306

 

// 소스 IP 로 확인하기

# tcpdump -i eno2 src 192.158.10.2

 

// 목적지 IP 로 확인하기

# tcpdump -i eno2 dst 192.158.10.3

 

// ping 으로 수신, 송신 확인하기

# tcpdump -nni eno2 icmp

# tcpdump -nni eno2 src 192.168.10.2 and icmp

 

 

반응형

댓글()

안드로이드 알람 생성 2가지 방법 (Android Notifications Tutorial with Examples)

프로그래밍/Android (Java)|2022. 7. 18. 12:13
반응형

아래 예제는 Notification 두 가지 방법을 다루고 있습니다.

1. 진동 및 알림 메세지가 전면 상단에 출력되며, 상태바에서도 아이콘으로 나타나는 방법

2. 진동 및 알림 메세지 없이 맨 위 상태바에서만 조용히 아이콘으로 나타나는 방법

 

 

아래는 원문 출처를 따라하며 요약한 내용입니다.

[출처] https://o7planning.org/10427/android-notification

==================================================

 

 

1. Empty Activity 로 프로젝트를 생성합니다.

 

 

2. 알림 메세지에 사용할 이미지 파일 두개를 생성합니다.

drawable/icon_notify1.png

drawable/icon_notify1.png

 

 

3. activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/editText_title"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:ems="10"
        android:hint="Title"
        android:inputType="textPersonName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <EditText
        android:id="@+id/editText_message"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="16dp"
        android:ems="10"
        android:hint="Message"
        android:inputType="textPersonName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/editText_title" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="33dp"
        android:text="Send on Channel 1"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/editText_message" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="23dp"
        android:text="Send On Channel 2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button1" />
</androidx.constraintlayout.widget.ConstraintLayout>

 

4. NotificationApp.java

package org.o7planning.notificationbasicexample;

import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;

public class NotificationApp extends Application  {

    public static final  String CHANNEL_1_ID = "channel1";
    public static final  String CHANNEL_2_ID = "channel2";

    @Override
    public void onCreate() {
        super.onCreate();

        this.createNotificationChannels();
    }

    private void createNotificationChannels()  {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            NotificationChannel channel1 = new NotificationChannel(
                    CHANNEL_1_ID,
                    "Channel 1",
                    NotificationManager.IMPORTANCE_HIGH
            );
            channel1.setDescription("This is channel 1");

            NotificationChannel channel2 = new NotificationChannel(
                    CHANNEL_2_ID,
                    "Channel 2",
                    NotificationManager.IMPORTANCE_LOW
            );
            channel1.setDescription("This is channel 2");


            NotificationManager manager = this.getSystemService(NotificationManager.class);
            manager.createNotificationChannel(channel1);
            manager.createNotificationChannel(channel2);
        }
    }
}

 

5. AndroidManifest.xml

<application
        android:name=".NotificationApp"
        ....
>
...
</application>

 

6. MainActivity.java

package org.o7planning.notificationbasicexample;

import android.app.Notification;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;


public class MainActivity extends AppCompatActivity {

    private NotificationManagerCompat notificationManagerCompat;

    private EditText editTextTitle;
    private EditText editTextMessage;

    private Button button1;
    private Button button2;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        this.editTextTitle = (EditText) this.findViewById(R.id.editText_title);
        this.editTextMessage = (EditText) this.findViewById(R.id.editText_message);

        this.button1 = (Button) this.findViewById(R.id.button1);
        this.button2 = (Button) this.findViewById(R.id.button2);

        this.button1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                sendOnChannel1(  );
            }
        });

        this.button2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                sendOnChannel2(  );
            }
        });

        //
        this.notificationManagerCompat = NotificationManagerCompat.from(this);
    }


    private void sendOnChannel1()  {
        String title = this.editTextTitle.getText().toString();
        String message = this.editTextMessage.getText().toString();

        Notification notification = new NotificationCompat.Builder(this, NotificationApp.CHANNEL_1_ID)
                .setSmallIcon(R.drawable.icon_notify1)
                .setContentTitle(title)
                .setContentText(message)
                .setPriority(NotificationCompat.PRIORITY_HIGH)
                .setCategory(NotificationCompat.CATEGORY_MESSAGE)
                .build();

        int notificationId = 1;
        this.notificationManagerCompat.notify(notificationId, notification);
    }

    private void sendOnChannel2()  {
        String title = this.editTextTitle.getText().toString();
        String message = this.editTextMessage.getText().toString();

        Notification notification = new NotificationCompat.Builder(this, NotificationApp.CHANNEL_2_ID)
                .setSmallIcon(R.drawable.icon_notify2)
                .setContentTitle(title)
                .setContentText(message)
                .setPriority(NotificationCompat.PRIORITY_LOW)
                .setCategory(NotificationCompat.CATEGORY_PROMO) // Promotion.
                .build();

        int notificationId = 2;
        this.notificationManagerCompat.notify(notificationId, notification);
    }
}

 

빌딩 이후 apk 파일을 설치, 어플을 실행하면 두 가지 예제의 알림 방식을 구분할 수 있습니다.

 

[출처] https://o7planning.org/10427/android-notification

반응형

댓글()

[C/C++] int 를 char 또는 const char* 로 변환하기

프로그래밍/C, C++|2022. 6. 30. 13:13
반응형

숫자 뒤에 0 을 붙이면 문자로 인식합니다.

 

const int pos = 100;

const char* charpos = pos+"0";

 

반응형

댓글()

[MySQL 에러] ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails 해결

리눅스/MySQL|2022. 6. 30. 10:10
반응형

레코드를 삭제할때 아래와 같은 에러 메세지가 출력되었다면

 

mysql> delete from log where idx='161';
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`baudit`.`checklist`, CONSTRAINT `fk_checklist_log1` FOREIGN KEY (`log_idx`) REFERENCES `log` (`idx`))

 

다른 곳 (checklist 테이블의 log_idx 컬럼) 에서 현재 삭제하려는 데이터 (log 테이블의 idx 컬럼) 를 참조하고 있다는 메세지 입니다.

해결 방법으로는 아래 두가지가 있습니다.

 

1. 관련 데이터 삭제

 

순차적으로 checklist 테이블에서 관련 레코드 삭제 후 log 테이블에서 해당 레코드 삭제

 

2. 참조 무시하고 삭제

 

mysql> SET foreign_key_checks = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from log where idx='161';
Query OK, 1 row affected (0.02 sec)

mysql> SET foreign_key_checks = 1;
Query OK, 0 rows affected (0.00 sec)

 

 

반응형

댓글()

[리눅스] png 이미지를 jpg 로 변환하기 (반대 포함)

자료실|2022. 6. 23. 12:07
반응형

이미지 파일의 형식을 변환 합니다.

또는 확장자는 그대로, 화질이나 사이즈 조정이 가능합니다.

- png > jpg

- jpg > png

 

1. 설치

 

CentOS

# yum -y install ImageMagick

 

Ubuntu

# apt-get -y install ImageMagick

 

2. 사용

 

# convert a.png b.jpg

a.png 파일을 b.jpg 파일로 변환

 

* 옵션

-quality 80 : 화질 80 수준

-resize 800x600 : 가로 800, 세로 600 사이즈로 변환

-colorspace gray : 흑백처리

- 사용 형식 : # convert a.png -quality 80 -resize 800x600 -colorspace gray b.jpg

 

 

반응형

댓글()

[리눅스] PDF 파일 여러개를 하나로 합치기

자료실|2022. 6. 23. 09:17
반응형

설치방법과 사용방법이 아주 쉽습니다.

 

1. 설치

 

CentOS

# yum -y install pdftk

 

Ubuntu

# apt-get -y install pdftk

 

2. 사용

 

# pdftk A.pdf B.pdf C.pdf cat output D.pdf

 

A.pdf, B.pdf, C.pdf 의 내용이 D.pdf 에 하나로 합쳐졌습니다.

 

 

반응형

댓글()

CentOS 7 에서 MySQL 8.0.29 설치 (gcc 관련 에러시에만 참고)

리눅스/MySQL|2022. 6. 20. 11:28
반응형

1. 필요 패키지 설치
# yum -y group install "Development Tools"
# yum -y install openssl openssl-devel ncurses ncurses-base ncurses-libs ncurses-devel perl bison


2. gcc 설치 (gcc 4.8.5 -> 7.3.0)
# yum -y install centos-release-scl
# yum -y install devtoolset-7-gcc*
# scl enable devtoolset-7 bash
# gcc --version

 

* 어떤 경우 gcc 8.3 우선 설치하고 scl.... 명령으로 7.3 으로 다운하여 사용하니 되기도 함

 

* 위와 같이 설치가 되지 않을 경우 아래와 같이 리포지토리 파일을 수동으로 생성합니다.

# vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
#baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/rh/
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-testing]
name=CentOS-7 - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

 

# vi /etc/yum.repos.d/CentOS-SCLo-scl.repo

# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
# baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/sclo/
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-testing]
name=CentOS-7 - SCLo sclo Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-debuginfo]
name=CentOS-7 - SCLo sclo Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

 

yum update 로 적용하고 다시 위로 올라가 재설치를 합니다.

 

[필수] MySQL 8.0.29 설치에 필요한 패키지를 추가 설치합니다.

# yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils

 

 

3. cmake 설치
# cd /usr/local/src
# wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2.tar.gz
# tar -zxvf cmake-3.16.2.tar.gz
# cd cmake-3.16.2
# ./bootstrap
# gmake
# make install
# cmake --version


4. mysql 설치

 

MySQL 8.0.29 는 설치도중 boost_1_77_0 을 다운로드 받아 압축 풀고 진행하는데,

내부 네트워크에서 인터넷 연결 안될 경우 수동으로 파일을 받아서 옮긴 뒤 아래와 같이 진행하면 됩니다.

 

(# wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2 ) 다운로드경로
# bunzip2 boost_1_77_0.tar.bz2
# tar xvf boost_1_77_0.tar
# mv boost_1_77_0 /usr/local/src/mysql-8.0.29/include/boost_1_77_0/

 

(생략)


cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DWITH_SSL=system -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/src/mysql-8.0.29/include/boost_1_77_0 -DFORCE_INSOURCE_BUILD=1


(생략)

 

 

반응형

댓글()

GCC 원하는 버전으로 업그레이드 하기 (CentOS 7, GCC 10.3.0)

리눅스/OS 일반|2022. 6. 17. 08:12
반응형

1. 현재 버전 확인
# gcc --version


2. 업그레이드
GCC 는 아래 공식 사이트에서 원하는 버전을 다운로드 받을 수 있습니다.

https://gcc.gnu.org/releases.html

# wget https://ftp.kaist.ac.kr/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.gz
# tar xvzf gcc-11.3.0.tar.gz
# cd gcc-11.3.0
# ./configure --disable-multilib --enable-languages=c,c++
# make
# make install


3. 변경된 버전 확인
# gcc --version

 

반응형

댓글()

CentOS 7 에서 MySQL client 8.0.21 설치하기 (caching_sha2_password 지원)

리눅스/MySQL|2022. 6. 9. 16:30
반응형

caching_sha2_password 지원이 되는 MySQL client 8 버전을 설치합니다.

 

1. 다운로드

# wget https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.21-1.el7.x86_64.rpm
# wget https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.21-1.el7.x86_64.rpm
# wget https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.21-1.el7.x86_64.rpm

 

2. 설치

의존성이 걸려 있으므로 아래 순서에 맞게 설치 합니다.

# rpm -ivh mysql-community-common-8.0.21-1.el7.x86_64.rpm 
# rpm -ivh mysql-community-libs-8.0.21-1.el7.x86_64.rpm 
# rpm -ivh mysql-community-client-8.0.21-1.el7.x86_64.rpm

 

이제 mysql 명령으로 외부 DB 서버에 접근이 가능합니다.

반응형

댓글()

MySQL 실시간 쿼리 확인

리눅스/MySQL|2022. 5. 25. 08:58
반응형

mysqladmin 명령어로 상태를 출력

 

# mysqladmin -i5 proc status -u root -p

Enter password:

~~

Uptime: 10578 Threads: 1 Questions: 4809 Slow queries: 589 Opens: 1321 Flush tables: 1 Open tables: 348 Queries per second avg: 0.454

 

 

Uptime : MySQL server 시삭된 후 현재 시간 (초 단위)

Threads : 현제 DB 서버에 연결된 유저수

Questions : 서버 시작후 지금까지 요청된 쿼리수

Slow queries : mysql 설정파일에 슬로우쿼리의 쿼리시간 이상을 가진 요청수

Opens : 서버가 시작된 후 현재까지 열렸던 테이블수

Open tables : 현재 열려 잇는 테이블 수

Queries per second avg : 평균 초단 쿼리수

 

 

[출처] https://jy-p.tistory.com/50

 

반응형

댓글()