#.Linux系統各文件作用
以騰訊雲服務器爲例:
uname -a
cat /etc/redhat-release
/bin: 可執行文件, 用戶命令
/boot: 系統啓動相關的文件,如內核、initrd,以及grub(bootloader)
/data 自己創建的文件
/dev: 設備文件,塊設備:隨機訪問,數據塊
字符設備:線性訪問,按字符爲單位
設備號:主設備號(major)和次號(minor)
/etc:配置文件(相關配置文件都在裏面)
/home:用戶的家目錄,每一個用戶的家目錄通常默認爲/home/USERNAME
/lib: 庫文件
靜態庫, .a
動態庫, .dll, .so (shared object)
/lib/modules:內核模塊文件
/lib64: 簡單說,/lib64是內核級的,/usr/lib64是系統級的,/usr/local/lib64是用戶級的.
/lost+found: 丟失與查找,linux系統出現文件是會記錄日誌文件至此
/media:掛載點目錄,移動設備
/mnt:掛載點目錄,額外的臨時文件系統
/opt:可選目錄,第三方程序的安裝目錄
/proc:僞文件系統,內核映射文件
/root: 管理員目錄
/run: linux中run文件,自行百度
/sbin: 管理命令
/srv: 服務器的安裝目錄。比如ftp服務器安裝完畢後,/srv下會增加一個ftp目錄。
/sys: 僞文件系統,跟硬件設備相關的屬性映射文件
/tmp:臨時文件, /var/tmp
/usr:這個目錄中包含了命令庫文件和在通常操作中不會修改的文件。
這個目錄對於系統來說也是一個非常重要的目錄,其地位類似Windows上面的”Program Files”目錄(安裝程序的時候,默認就是安裝在此文件內部某個子文件夾內。輸入命令後系統默認執行/usr/bin下的程序(當然,前提是這個目錄的路徑已經被添加到了系統的環境變量中。此目錄通常也會掛載一個獨立的磁盤分區,它應保存共享只讀類文件,這樣它可以被運行Linux的不同主機掛載。
/var:可變化的文件,var目錄主要針對常態性變動文件,包括緩存(cache)、登錄文件(logfile)以及某些軟件運行所產生的文件,包括程序文件(lock file,run file),或者例如Mysql數據庫的文件等。
#.容器內目錄結構
docker進入容器命令
docker exec -it 容器id /bin/bash
可以發現:docker中的一個容器就是一個linux,裏面的文件和文件作用與linux系統是一致的!
/etc :配置文件,mysql的配置文件會放在這裏面
/var/lib/mysql: mysql數據存放位置
查看/etc/mysql/my.cnf文件
my.cnf文件:
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Custom config should go here
!includedir /etc/mysql/conf.d/
mysql數據文件位置:
找到:datadir = /var/lib/mysql
以下位置都是在mysql容器內
mysql容器配置文件位置:/etc/mysql下my.cnf文件
mysql容器數據文件位置:/var/lib/mysql下全部文件
mysql容器日誌文件位置:unknown我沒找到日誌文件的位置