容器運行常見數據庫

一.涉及鏡像壓縮包

  • 均為amd架構
  • 版本:mysql:5.7.42、postgres:13.16、dm8:20250206_rev257733_x86_rh6_64、oceanbase-ce:v4.0、opengauss:5.0.2

通過網盤分享的文件:db.tgz
鏈接: https://pan.baidu.com/s/1EBbFPZj1FxCA4_GxjVunWg?pwd=563s 提取碼: 563s

二.mysql-5.7.42

  • 容器執行命令
docker run --name mysql -p 20307:3306 --restart=always --privileged=true \
-e MYSQL_ROOT_PASSWORD="SLBmysql2025" \
-v /data/mysql/my.cnf:/etc/my.cnf \
-v /data/mysql/data:/var/lib/mysql \
-d xxx/mysql:5.7.42
  • my.cnf文件(/data/mysql/my.cnf)
[mysqld]
port=3306
skip-host-cache
skip-name-resolve
datadir=/var/lib/mysql
socket=/run/mysqld/mysqld.sock
secure-file-priv=/var/lib/mysql-files
user=mysql
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
slow_query_log_file = /var/lib/mysql/mysql-slow.log
log_bin = mysql-bin
slow_query_log_file = /var/lib/mysql/mysql-slow.log
server-id = 1
bind-address = 0.0.0.0
default_time_zone = '+08:00'
log_timestamps = SYSTEM
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
back_log = 300
max_connections = 5000
max_connect_errors = 1000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
binlog_format = mixed
expire_logs_days = 30
max_binlog_size =1G
slow_query_log = 1
long_query_time = 1
performance_schema = 0
explicit_defaults_for_timestamp
lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
interactive_timeout = 28800
wait_timeout = 28800[mysqldump]
quick
max_allowed_packet = 100M[client]
port = 3306
socket=/run/mysqld/mysqld.sock!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

三.postgresql:13.16

  • 容器執行命令
docker run --name postgres13-16 --restart=always --privileged=true \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD="SLBpg2025" \
-p 25432:5432 \
-v /data/pg/data:/var/lib/postgresql/data \
-d xxx/postgres:13.16
  • 運行后修改/data/pg/data/postgresql.conf
listen_addresses = '*'
port = 5432
max_connections = 2000
superuser_reserved_connections = 10
password_encryption = scram-sha-256
shared_buffers = 128MB
dynamic_shared_memory_type = posix
wal_level = replica
max_wal_size = 4096MB    
min_wal_size = 80MB   
max_wal_senders = 10
wal_keep_size= 4096MB   
synchronous_standby_names = '*'
hot_standby = on
log_destination = 'stderr'
logging_collector = on
log_directory = 'log'
log_filename = 'postgresql-%a.log'
log_truncate_on_rotation = on
log_rotation_age = 1d
log_rotation_size = 0
log_line_prefix = '%m [%p] '
log_timezone = 'PRC'
log_statement = 'all'  
log_duration = on  
log_min_duration_sample = 30000ms
log_statement_sample_rate = 0.2
datestyle = 'iso, mdy'
timezone = 'PRC'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
default_text_search_config = 'pg_catalog.english'
archive_mode = on   
archive_command = 'gzip < %p > /var/lib/postgresql/data/pg_wal/%f.gz'         
shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.max = 10000
pg_stat_statements.track = all
  • 創建擴展
--連接到數據庫后創建擴展
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
SELECT * FROM pg_extension WHERE extname = 'pg_stat_statements';

四.dm V8

  • 容器執行命令
docker run -p 30236:5236 --restart=always --name=dm8 --privileged=true \
-e SYSDBA_PWD="SLBsysdba2025" \
-e LD_LIBRARY_PATH=/opt/dmdbms/bin \
-e PAGE_SIZE=16 -e EXTENT_SIZE=32 -e CASE_SENSITIVE=1 \
-e LOG_SIZE=1024 -e UNICODE_FLAG=1  \
-e INSTANCE_NAME=dm8 \
-v /data/dm/data:/opt/dmdbms/data \
-d xxx/dm8:20250206_rev257733_x86_rh6_64

五.oceanbase V4.0

  • 容器執行命令
docker run -p 22881:2881 -m 8G --name=obce-4.0 --restart=always --privileged=true \
-e MODE=NORMAL -e OB_DATA_DIR=/data \
-itd xxx/oceanbase-ce:v4.0
  • 進入容器啟動server
docker exec -it obce-4.0 bash[admin@0fd82061e752 ~]$ obd cluster list
+------------------------------------------------------------+
|                        Cluster List                        |
+--------+---------------------------------+-----------------+
| Name   | Configuration Path              | Status (Cached) |
+--------+---------------------------------+-----------------+
| obdemo | /home/admin/.obd/cluster/obdemo | deployed        |
+--------+---------------------------------+-----------------+
[admin@0fd82061e752 ~]$ obd cluster start obdemo 
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (127.0.0.1) clog and data use the same disk (/)Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -prootPWD123 -Doceanbase+---------------------------------------------+
|                   obproxy                   |
+-----------+------+-----------------+--------+
| ip        | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884            | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -prootPWD123 -Doceanbase
obdemo running
  • 根據輸出信息驗證聯通性
obclient -h127.0.0.1 -P2881 -uroot -prootPWD123 -Doceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -AWelcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221487617
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov  1 2022 14:56:31)Copyright (c) 2000, 2018, OB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]>
obclient [oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ORAAUDITOR         |
| SYS                |
| test               |
+--------------------+
7 rows in set (0.008 sec)

六.opengauss 5.0.2

  • 容器運行命令
docker run --name=opengauss-5.0.2 --privileged=true --restart=always \
-e GS_PASSWORD=SLBopengauss@2025 \
-e LD_LIBRARY_PATH="/usr/local/opengauss/lib:$LD_LIBRARY_PATH" \
-v /data/opengauss/data:/var/lib/opengauss  \
-u root -p 15432:5432 \
-d xxx/opengauss:5.0.2
  • 進入容器創建軟鏈接,驗證連通性
[root@master01 opengauss]# docker exec -it opengauss-5.0.2 bash
root@bb7dece59a51:/# ln -s /usr/local/opengauss/bin/gsql /usr/local/bin/gsql
root@bb7dece59a51:/# gsql -dpostgres -Ugaussdb -W'SLBopengauss@2025' -h127.0.0.1 -p5432
gsql ((openGauss 5.0.2 build 48a25b11) compiled at 2024-05-14 10:26:01 commit 0 last mr  )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.openGauss=> \lList of databasesName    | Owner | Encoding | Collate | Ctype | Access privileges 
-----------+-------+----------+---------+-------+-------------------omm       | omm   | UTF8     | C       | C     | postgres  | omm   | UTF8     | C       | C     | template0 | omm   | UTF8     | C       | C     | =c/omm           +|       |          |         |       | omm=CTc/ommtemplate1 | omm   | UTF8     | C       | C     | =c/omm           +|       |          |         |       | omm=CTc/omm
(4 rows)
  • 在/data/opengauss/data/data/postgresql.conf中修改配置文件所需參數即可

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/895779.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/895779.shtml
英文地址,請注明出處:http://en.pswp.cn/news/895779.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python爬蟲系列課程2:如何下載Xpath Helper

python爬蟲系列課程2:如何下載Xpath Helper 一、訪問極簡插件官網二、點擊搜索按鈕三、輸入xpath并點擊搜索四、點擊推薦下載五、將下載下來的文件解壓縮六、打開擴展程序界面七、將xpath.crx文件拖入擴展程序界面一、訪問極簡插件官網 極簡插件官網地址:https://chrome.zzz…

PHP支付寶--轉賬到支付寶賬戶

官方參考文檔&#xff1a; ?https://opendocs.alipay.com/open/62987723_alipay.fund.trans.uni.transfer?sceneca56bca529e64125a2786703c6192d41&pathHash66064890? 可以使用默認應用&#xff0c;也可以自建新應用&#xff0c;此處以默認應用來講解【默認應用默認支持…

前端開發崗模擬面試題套卷A答案及解析(一)技術面部分

前端開發崗模擬面試題套卷A答案及解析(一)技術面部分 (一)技術面 一、JavaScript核心技術(ES6+) 1-1、實現防抖函數 function debounce(fn, delay) {let timer = null;return function(...args) {clearTimeout(timer); // 清除已有定時器timer = setTimeout(() =>…

對稱加密算法——IDEA加密算法

Java IDEA算法詳解 1. 理論背景 IDEA&#xff08;International Data Encryption Algorithm&#xff09;是一種對稱密鑰加密算法&#xff0c;由Xuejia Lai和James Massey于1991年提出。它被設計用于替代DES&#xff08;Data Encryption Standard&#xff09;算法&#xff0c;…

單例模式、構造函數、左值右值

拷貝構造函數 簡單的說就是——用一個對象構造另外一個對象 class Myclass {public:int d0;Myclass(int d_){d d_}; //常用的構造函數Myclass(Myclass c) //拷貝構造函數{d c.d;} }; //對比 class Myclass {public:int d0;Myclass(int d_){d d_}; //常用的構造函數Myclass…

rustdesk遠程桌面自建服務器

首先&#xff0c;我這里用到的是阿里云服務器 centos7版本&#xff0c;win版客戶端。 準備工作 centos7 服務器端文件&#xff1a; https://github.com/rustdesk/rustdesk-server/releases/download/1.1.11-1/rustdesk-server-linux-amd64.zip win版客戶端安裝包&#xff1…

【深度學習】Transformer入門:通俗易懂的介紹

【深度學習】Transformer入門&#xff1a;通俗易懂的介紹 一、引言二、從前的“讀句子”方式三、Transformer的“超級閱讀能力”四、Transformer是怎么做到的&#xff1f;五、Transformer的“多視角”能力六、Transformer的“位置記憶”七、Transformer的“翻譯流程”八、Trans…

用deepseek學大模型03-數學基礎 概率論 最大似然估計(MLE)最大后驗估計(MAP)

https://metaso.cn/s/r4kq4Ni 什么是最大似然估計&#xff08;MLE&#xff09;最大后驗估計&#xff08;MAP&#xff09;&#xff1f;深度學習中如何應用&#xff0c;舉例說明。 好的&#xff0c;我現在需要回答關于最大似然估計&#xff08;MLE&#xff09;和最大后驗估計&…

Socket通訊協議理解及客戶端服務器程序流程

Socket通訊我們可以從以下幾個方面簡單理解 1.Socket是網絡通信中的一項重要技術&#xff0c;它提供了在網絡上進行數據交換的接口。用C#、Java、C等開發語言&#xff0c;都可以開發Socket網絡通信程序。 2.Socket(套接字)是計算機網絡編程中的一種抽象&#xff0c;它允許不同…

《Stable Diffusion繪畫完全指南:從入門到精通的Prompt設計藝術》-配套代碼示例

第一章&#xff1a;模型加載與基礎生成 1.1 基礎模型加載 from diffusers import StableDiffusionPipeline import torch# 加載SD 1.5基礎模型&#xff08;FP32精度&#xff09; pipe StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",…

【DL】淺談深度學習中的知識蒸餾 | 輸出層知識蒸餾

目錄 一 核心概念與背景 二 輸出層知識蒸餾 1 教師模型訓練 2 軟標簽生成&#xff08;Soft Targets&#xff09; 3 學生模型訓練 三 擴展 1 有效性分析 2 關鍵影響因素 3 變體 一 核心概念與背景 知識蒸餾&#xff08;Knowledge Distillation, KD&#xff09;是一種模…

嵌入式學習第十六天--stdio(二)

文件打開 open函數 #include <fcntl.h> int open(const char *pathname&#xff0c;int flags); int open(const char *pathname&#xff0c;int flags&#xff0c;mode_t mode); 功能: 打開或創建文件 參數: pathname //打開的文件名 flags //操作…

對話智面創始人陶然:一是初心和心態,二是堅持和心力

隨著經濟全球化的加深和市場競爭的日益激烈&#xff0c;企業迅速發展成為了每一個企業家的夢想。然而&#xff0c;要實現企業的快速發展并保持競爭力&#xff0c;企業戰略的人力資源管理起著至關重要的作用。 企業的核心競爭力是“人才”的競爭&#xff0c;無論是研發、銷售、…

mybatis使用typeHandler實現類型轉換

使用mybatis作為操作數據庫的orm框架&#xff0c;操作基本數據類型時可以通過內置的類型處理器完成java數據類型和數據庫類型的轉換&#xff0c;但是對于擴展的數據類型要實現與數據庫類型的轉換就需要自定義類型轉換器完成&#xff0c;比如某個實體類型存儲到數據庫&#xff0…

Qt開發①Qt的概念+發展+優點+應用+使用

目錄 1. Qt的概念和發展 1.1 Qt的概念 1.2 Qt 的發展史&#xff1a; 1.3 Qt 的版本 2. Qt 的優點和應用 2.1 Qt 的優點&#xff1a; 2.2 Qt 的應用場景 2.3 Qt 的應用案例 3. 搭建 Qt 開發環境 3.1 Qt 的開發工具 3.2 Qt SDK 的下載和安裝 3.3 Qt 環境變量配置和使…

mac安裝Pyspark并連接Mysql

安裝Scala, apache-spark, Hadoop brew install scala brew install apache-spark brew install hadoop pip install pyspark注意不要自己另外安裝jdk, 會造成版本對不上報錯。因為安裝apache-spark的過程中會自動安裝openjdk。 配置環境變量 JAVA_HOME/opt/homebrew/Cellar…

【Go語言快速上手】第二部分:Go語言進階之網絡編程

文章目錄 前言&#xff1a;網絡編程一、TCP/UDP 編程&#xff1a;net 包的使用1. TCP 編程1.1 TCP 服務器1.2 TCP 客戶端 2. UDP 編程2.1 UDP 服務器2.2 UDP 客戶端 二、HTTP 編程&#xff1a;net/http 包的使用&#xff0c;編寫 HTTP 服務器和客戶端2.1 HTTP 服務器2.2 HTTP 客…

王炸 用AI+飛書 分解 一鍵生成 項目計劃表模版

效果圖&#xff1a; 各字段設置&#xff1a; 以下是一個使用 AI&#xff08;DeepSeeker&#xff09; 飛書多維表格分解項目待辦模板的示例&#xff0c;你可以根據實際情況進行調整和優化&#xff1a; 列表中需要選擇對象&#xff0c;且選擇輸出結果&#xff08;記得控制字符長度…

從月牙定理看古希臘數學的奇妙突破

文章目錄 每日一句正能量前言古希臘人的 “化圓為方” 之夢&#xff08;一&#xff09;幾何作圖的基本規則&#xff08;二&#xff09;化圓為方問題的起源與發展&#xff08;三&#xff09;化圓為方的意義 月牙面積定理的誕生&#xff08;一&#xff09;希波克拉底的生平與成就…

實戰:vLLM多機多卡部署大模型

兩臺服務器 1. Docker容器中使用GPU 必須確保已安裝并配置 NVIDIA Docker。你可以安裝 nvidia-docker 來確保 GPU 驅動能夠被 Docker 使用 #安裝 nvidia-docker&#xff1a; sudo apt-get install nvidia-docker2#然后重啟 Docker&#xff1a; sudo systemctl restart docke…