国产精品chinese,色综合天天综合精品网国产在线,成午夜免费视频在线观看,清纯女学生被强行糟蹋小说

    <td id="ojr13"><tr id="ojr13"><label id="ojr13"></label></tr></td>
        • <source id="ojr13"></source>
            <td id="ojr13"><ins id="ojr13"><label id="ojr13"></label></ins></td>

            Article / 文章中心

            需要搭建一個高性能的文件系統(tǒng)?我推薦你試試它.....(中)

            發(fā)布時間:2022-02-21 點擊數(shù):720
            • storage.conf


            #這個裝備文件是否 不收效(這兒筆者個人認(rèn)為,改成是否收效會比較好),true代表不收效,false代表收效 disabled = false #組名 group_name = group1 #是否綁定ip,假如不填就代表所有的ip都供給服務(wù),常用于服務(wù)器有多個ip但只希望一個ip供給服務(wù) bind_addr = # 當(dāng)指定bind_addr 本參數(shù)才有用 # storage作為客戶端鏈接其他服務(wù)器時,是否綁定bind_addr client_bind = true # 本storage服務(wù)器的端口號 port = 23000 # 銜接超時時刻 針對套接字socket函數(shù)connect connect_timeout = 5 # storage server的網(wǎng)絡(luò)超時時刻,單位為秒。接納或發(fā)送數(shù)據(jù)時,假如在超時時刻后還不能發(fā)送或接納數(shù)據(jù),則本次網(wǎng)絡(luò)通信失利。 network_timeout = 60 # 心跳距離時刻 單位為秒 heart_beat_interval = 30 # storage server向tracker server報告磁盤剩余空間的時刻距離,單位為秒 stat_report_interval = 60 # base_path目錄地址,該目錄有必要存在 base_path = /home/yuqing/fastdfs # 最大銜接數(shù) max_connections = 1024 # 設(shè)置行列結(jié)點的buffer巨細(xì)。作業(yè)行列耗費的內(nèi)存巨細(xì) = buff_size * max_connections # 設(shè)置得大一些,體系整體功用會有所進(jìn)步。 # 耗費的內(nèi)存請不要超越體系物理內(nèi)存巨細(xì)。別的,對于32位體系,請留意運用到的內(nèi)存不要超越3GB buff_size = 256KB # 接納懇求的線程數(shù) accept_threads = 1 # 作業(yè)線程數(shù) 通常設(shè)置為cpu數(shù) work_threads = 4 # 磁盤讀寫是否別離 disk_rw_separated = true # disk reader thread count per store path # for mixed read / write, this parameter can be 0 # default value is 1 # since V2.00 # 磁盤 讀 線程數(shù)量 disk_reader_threads = 1 # 磁盤 寫 線程數(shù)量 disk_writer_threads = 1 # 同步文件時 假如從binlog中沒有讀到要同步的文件,則休眠N毫秒后重新讀取,0表明不休眠。 # 同步等待時刻 單位ms sync_wait_msec = 50 # 同步距離:同步上一個文件后,再同步下一個文件的時刻距離 單位為秒 sync_interval = 0 # 同步開始時刻 sync_start_time = 00:00 # 同步結(jié)束時刻 sync_end_time = 23:59 # 同步完N個文件后,把storage的mark文件同步到磁盤 # 注:假如mark文件內(nèi)容沒有變化 則不會同步 write_mark_file_freq = 500 # 磁盤恢復(fù)線程 disk_recovery_threads = 3 # 寄存文件途徑個數(shù) 寄存文件時storage server支撐多個途徑(能夠理解為windows的分區(qū))。 store_path_count = 1 # store_path_count裝備多少,這兒就寫多少個途徑,留意:途徑有必要存在。 store_path0 = /home/yuqing/fastdfs #store_path1 = /home/yuqing/fastdfs2 # FastDFS存儲文件時 選用256*256結(jié)構(gòu)的二級目錄,這兒裝備寄存文件的目錄個數(shù) subdir_count_per_path = 256 # tracker server的列表 有幾個trackers server 就寫幾個 tracker_server = 192.168.209.121:22122 tracker_server = 192.168.209.122:22122 # 規(guī)范日志等級從小到大順次:debuglog_level = info # 操作體系運轉(zhuǎn)FastDFS的用戶組,不填默認(rèn)便是發(fā)動FastDFS的用戶組 run_by_group= # 操作體系運轉(zhuǎn)FastDFS的用戶,不填默認(rèn)便是發(fā)動FastDFS的用戶 run_by_user = # 能夠銜接到此Tracker Server的IP范圍 # 比方: # allow_hosts=10.0.1.[1-15,20] # allow_hosts=host[01-08,20-25].domain.com # allow_hosts=192.168.5.64/26 allow_hosts = * # 文件在data目錄下渙散存儲的戰(zhàn)略 # 0:輪流,再一個目錄下存儲設(shè)置的文件數(shù)后,運用下一個目錄進(jìn)行寄存 # 1:隨機,依據(jù)文件名對應(yīng)的hash_code進(jìn)行渙散存儲(推薦) file_distribute_path_mode = 1 # 文件寄存?zhèn)€數(shù)到達(dá)本參數(shù)值時,運用下一個目錄進(jìn)行寄存 # 留意:只要當(dāng)file_distribute_path_mode設(shè)置為1時,這個參數(shù)才有用 file_distribute_rotate_count = 100 # 當(dāng)寫入大文件時 每寫入N個字節(jié),調(diào)用一次體系函數(shù)fsync將內(nèi)容強行同步到硬盤。0表明不調(diào)用fsync fsync_after_written_bytes = 0 # 同步或刷新日志到硬盤的時刻距離,單位為秒 # 留意:storage server 的日志信息不是直接寫硬盤的,而是先寫內(nèi)存再寫硬盤 sync_log_buff_interval = 1 # 同步binlog日志到硬盤的時刻距離 單位為秒 sync_binlog_buff_interval = 1 # 把storage的stat文件同步到硬盤的時刻距離 單位為秒· sync_stat_file_interval = 300 # 線程棧的巨細(xì) # 線程棧越大,一個線程占用的體系資源就越多,能夠發(fā)動的線程就越少。 thread_stack_size = 512KB # 上傳優(yōu)先級 值越小 優(yōu)先級越高 和tracker.conf的storage_server = 2時的裝備相對應(yīng) upload_priority = 10 #NIC別號前綴,比方Linux中的eth,能夠經(jīng)過ifconfig-a看到 #用逗號分隔的多個別號??罩当砻靼床僮黧w系類型主動設(shè)置 #默認(rèn)值為空 if_alias_prefix = # 檢查文件是否重復(fù),假如設(shè)置為true,則運用FastDHT去存儲文件的索引(需求先裝置FastDHT) # 1或許yes 需求檢查 # 0或許no 不需求檢查 check_file_duplicate = 0 # 文件去重時,文件內(nèi)容的簽名方法 # hash:4個hashcode # MD5:MD5 file_signature_method = hash # 當(dāng)上個參數(shù)設(shè)置為1或許yes時,本參數(shù)有用 # FastDHT中的命名空間 key_namespace = FastDFS # 與FastDHT server的銜接方法 是否為耐久銜接 # 0 短鏈接 1 長銜接 keep_alive = 0 # you can use "#include filename" (not include double quotes) directive to # load FastDHT server list, when the filename is a relative path such as # pure filename, the base path is the base path of current/this config file. # must set FastDHT server list when check_file_duplicate is true / on # please see INSTALL of FastDHT for detail ##include /home/yuqing/fastdht/conf/fdht_servers.conf # 是否將文件操作記載到access_log use_access_log = false # 是否定期切割access_log rotate_access_log = false # access_log切割時刻 access_log_rotate_time = 00:00 # 是否緊縮舊的access_log compress_old_access_log = false # 緊縮多久之前的access_log compress_access_log_days_before = 7 # 是否切割error_log rotate_error_log = false # 切割error_log的時刻 error_log_rotate_time = 00:00 # 是否緊縮error_log compress_old_error_log = false # 緊縮多久之前的error_log compress_error_log_days_before = 7 # 當(dāng)access_log到達(dá)必定巨細(xì)時切割  0表明不按巨細(xì)切割 rotate_access_log_size = 0 # 當(dāng)error_log到達(dá)必定巨細(xì)時切割 0表明不按巨細(xì)切割 rotate_error_log_size = 0 # 日志文件保存天數(shù) 0表明不刪去 log_file_keep_days = 0 # 日志同步是否忽略無效的binlog記載 file_sync_skip_invalid_record = false # 是否運用線程池 use_connection_pool = true # 最大空閑銜接時刻,只要運用線程池這個裝備才有用 connection_pool_max_idle_time = 3600 # 是否緊縮binlog日志 compress_binlog = true # 緊縮binlog日志的時刻 compress_binlog_time = 01:30 # 是否檢查存儲途徑符號 check_store_path_mark = true # storage server上web server域名,通常僅針對單獨布置的web server。這樣URL中就能夠經(jīng)過域名方法來訪問storage server上的文件了 # 參數(shù)為空表明運用ip訪問 http.domain_name = # storage服務(wù)器端口 http.server_port = 8888


            • 需求裝備tracker.conf和storage.conf


            #tracker.conf需求裝備如下幾個當(dāng)?shù)?# Tracker端口號 port = 22122 # 根底目錄 懇求后生成日志文件 這個目錄需求手動創(chuàng)立 有必要保證存在 base_path = /home/fdfs/log/tracker


            #storage.conf需求裝備如下幾個當(dāng)?shù)?# 組名 暫時保持默認(rèn) group_name = group1 # 存儲節(jié)點端口號 port = 23000# 寄存存儲節(jié)點日志的根底目錄 這個目錄需求手動創(chuàng)立 保證存在 base_path = /home/fdfs/log/storage # 文件需求寄存到哪個目錄下 store_path0 = /home/fdfs/file/storage # 追尋器地址 tracker_server = 192.168.137.17:22122


            • 發(fā)動



            咱們需求進(jìn)行一些最小裝備,來支撐FastDFS的發(fā)動。


            首先是tracker.conf



            # 1.綁定ip bind_addr = 192.168.137.3 # 2.設(shè)置端口 port = 22122 # 3.base目錄 該目錄需求手動創(chuàng)立,有必要保證存在 base_path = /WorkSpace/SoftwareData/fdfs/log/tracker


            • 然后是storage.conf


            # 1.設(shè)置group_name group_name = group1 # 2.綁定ip bind_addr = 192.168.137.3 # 3.設(shè)置端口號 port = 23000 # bast_path 該途徑有必要手動創(chuàng)立 base_path = /WorkSpace/SoftwareData/fdfs/log/storage # 裝備storage存儲文件的途徑 store_path0 = /WorkSpace/SoftwareData/fdfs/data/storage0 # Tracker Server的ip tracker_server = 192.168.137.3


            • 裝備好而且檢查裝備文件中的目錄都存在之后,將裝備文件拷貝到/etc/fdfs目錄下,然后發(fā)動tracker和storage即可。


            #發(fā)動指令:fdfs_trackerd/fdfs_storaged 裝備文件 start #關(guān)閉指令:fdfs_trackerd/fdfs_storaged 裝備文件 stop #重啟指令:fdfs_trackerd/fdfs_storaged 裝備文件 restart #最好不要運用kill -9 強制殺進(jìn)程,這樣會導(dǎo)致文件不同步 [root@localhost /]# fdfs_trackerd /etc/fdfs/tracker.conf start [root@localhost /]# fdfs_storaged /etc/fdfs/storage.conf start [root@localhost /]# ps -ef|grep fdfs root      1652     1  0 22:58 ?        00:00:00 fdfs_trackerd /etc/fdfs/tracker.conf start root      1661     1  0 22:58 ?        00:00:00 fdfs_storaged /etc/fdfs/storage.conf start root      1671  1515  0 22:58 pts/0    00:00:00 grep --color=auto fdfs


            • FastDFS的文件存儲方法


            發(fā)動FastDFS后,能夠去到咱們剛才在storage.conf中裝備的storage_path目錄下,能夠看到FastDFS在這個目錄下創(chuàng)立了一個data目錄,在data目錄中創(chuàng)立了256*256個文件夾,用于渙散存儲數(shù)據(jù),這樣能夠進(jìn)步查找文件的功率。這個便是上文中所說的,F(xiàn)astDFS解決IO功率的一種手段,將文件散布到每個目錄下,類似于Java中的HashMap,經(jīng)過文件的HashCode,敏捷判別文件的方位然后找到文件。


            image.png


              • 至此咱們的FastDFS現(xiàn)已成功發(fā)動。
              1. 檢查Linux上是否裝置了GCC、libevent、libevent-devel


            yum list installed|grep gcc yum list installed|grep libevent yum list installed|grep libevent-devel


              1. 假如沒有裝置,則需進(jìn)行裝置


            yum install gcc libevent libevent-devel -y


            • 功用測驗
              上文中咱們現(xiàn)已將FastDFS成功發(fā)動,而且能夠看到發(fā)動后數(shù)據(jù)目錄的變化?,F(xiàn)在咱們就能夠運用客戶端來測驗一下FastDFS的功用了。
              首先咱們需求裝備一下客戶端,在/etc/fdfs目錄下找到client.conf裝備文件,進(jìn)行如下的最小裝備:


            #client.conf 需求改如下兩個當(dāng)?shù)氐难b備 # 日志根底途徑  必定要手動創(chuàng)立 不然無法運用client測驗 base_path = /home/fdfs/log/client # 追尋器地址 tracker_server = 192.168.137.17:22122


            • 裝備完畢后,需求在任意目錄下,創(chuàng)立一個用于測驗的文件。


            [root@localhost /]# touch fdfstest [root@localhost /]# echo "A fdfs test file">>fdfstest [root@localhost /]# cat fdfstest A fdfs test file


            • 創(chuàng)立好文件并寫入內(nèi)容后,就能夠?qū)σ巡贾玫膄dfs進(jìn)行各種方法的測驗了。
              首先是文件上傳,F(xiàn)astDFS自帶的客戶端經(jīng)過fdfs_test 裝備文件 upload 需求上傳的文件途徑進(jìn)行文件的上傳,示例如下:


            [root@localhost /]# fdfs_test /etc/fdfs/client.conf upload /fdfstest This is FastDFS client test program v6.06 Copyright (C) 2008, Happy Fish / YuQing FastDFS may be copied only under the terms of the GNU General Public License V3, which may be found in the FastDFS source kit. Please visit the FastDFS Home Page http://www.fastken.com/ for more detail. [2020-09-18 22:15:54] DEBUG - base_path=/WorkSpace/SoftwareData/fdfs/client, connect_timeout=5, network_timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0 tracker_query_storage_store_list_without_group:  server 1. group_name=, ip_addr=192.168.137.3, port=23000 # storage信息 group_name=group1, ip_addr=192.168.137.3, port=23000 storage_upload_by_filename # group_name:文件上傳到的組 # remote_filename:文件上傳到的長途途徑 M00代表第一個storage 也便是剛才裝備的storage0,能夠理解為分區(qū),總的一個文件目錄結(jié)構(gòu)便是:組名/磁盤/目錄/文件名 group_name=group1, remote_filename=M00/ED/49/wKiJA19kwRqAI_g6AAAAEbcXlKw7921454 source ip address: 192.168.137.3 file timestamp=2020-09-18 22:15:54 file size=17 file crc32=3071775916 # 在后期進(jìn)行一些裝備后,能夠經(jīng)過這個url直接訪問文件 example file url: http://192.168.137.3/group1 storage_upload_slave_by_filename group_name=group1, remote_filename=M00/ED/49/wKiJA19kwRqAI_g6AAAAEbcXlKw7921454_big source ip address: 192.168.137.3 file timestamp=2020-09-18 22:15:54 file size=17 file crc32=3071775916 example file url: http://192.168.137.3/group1/M00/ED/49/wKiJA19kwRqAI_g6AAAAEbcXlKw7921454_big


            • 當(dāng)執(zhí)行完這條指令之后,咱們能夠看到文件上傳到的storage server的一些信息,例如group_name,ip,端口等,還能夠看到咱們的文件上傳到那個group,存在這個group的哪個途徑下。
              本次咱們上傳的文件經(jīng)過返回信息,能夠看到上傳到group1下(由于咱們只要一個storage而且只設(shè)置了一個group),上傳到的途徑為M00/ED/49/wKiJA19kwRqAI_g6AAAAEbcXlKw7921454,那么就能夠到這個目錄下檢查一下這個文件是否現(xiàn)已上傳成功了。