WordPress學習1

本來想買sugar Host 虛擬主機 , 但結果看到原來它的155元/月, 是要一次買3年, 而且要外稅, 所以買下來就快6千元了, 是不貴, 但不知道好不好用, 品質不好的話, 那不等於是打水漂~~ 所以很猶豫。

上網查了一下, 發現網站帶路姬 的建議是採用SiteGround或者是Bluehost, 否則其它的虛擬主機都曾遇過怪怪的連不上問題, 所以害我也很耽心買了會浪費錢。

後來只有自己用docker 架設來試試, 希望可以順利成功~~

申請無卡提款功能

以前中國信託一直出現無卡提款功能的廣告, 我一直覺得沒必要, 徒增帳戶的風險, 但是當你發生意外情況時, 才會覺得它其實是一大福音及應付緊急情況的保障.

8月15日帶小朋友去景美買制服及書包, 結果騎了一個小時到達學校時才發現皮夾竟然不在手袋裡, 這情況雖然好幾年才出現一次, 但是它就是發生了, 身上除了手機外, 沒有任何現金、提款卡及信用卡, 真是不知道怎麼辦, 再回去拿來回要二個小時, 制服廠商都離開了.

當時還好想到阿漢住在附近, 趕緊給他打個電話求助, 結果他回汐止長輩家裡, 還好他岳母在家帶小朋友, 讓我去他家借用現金, 才解了燃眉之急, 真是出外靠朋友, 一點都沒錯

為了預防這種情事會再發生(年紀大了, 發生的機率會變高), 也想了好些方案, 但昨天在提款機領錢時又再一次看到無卡提款的功能廣告, 於是決定申請來用, 在申請完後才去了解, 原來它所謂的無卡, 其實是要用手機去掃提款機的QRCode , 才能進行, 不是我之前預想的要自己記得帳戶號碼. 相對也安全一些, 今天下午可能要透過這方式來提領一下現金, 練習操作, 免得真的再一次遇到時不會使用, 就糗大了.

凡事有準備, 遇事才不會慌, 再一次被體現。

大學同學聚餐

今天高副總生日,約了幾位同學一起吃飯, 黃院長找了一家機場旁的諾富特飯店, 大家中午一起約在飯店吃飯聊天, 高副總很熱心的給大家帶來了鹿港名產的等路, 有綠豆糕和牛舌餅

大家多年未見面, 一開始還沒有放得很開, 後來漸漸的聊開來,今天星期日, 餐廳沒有坐滿, 大約只有1/3而已, 很適合我們聊天, 一直聊到3點半被趕出去,才分別回家

今天是我第一次搭機捷, 坐到機場旅館站要130元, 每班時間大約隔15到20分, 而且沿路位置都沒坐滿, 看來應該是做公德的虧錢路線.

 

水塔漏水

曾隔壁反應我家的水塔漏水導致他家滲水問題, 之前已經把水關掉, 水塔的水位低於30公分, 昨天有去他家裡拍照, 確認牆壁是乾的, 然後將水塔放水的水龍頭關閉, 正常蓄水, 今天早上就來告知, 已經出現滲水, 我至三樓的樓梯壁上看, 果然是有水滲出, 確認因為水塔漏水所致(昨天到今天都沒有下雨)

但有發現一件事, 也是問題的根源, 因為我們這一排房子很老舊了, 當初都是只有二樓, 而我們先建三樓, 將水塔放在三樓頂, 之後十幾年,隔壁才建三樓,但前門的地方, 有建牆壁, 而後面卻沒有, 直接使用我家的牆壁, 導致我家的水塔漏水會滲到他們家

[開心一笑]老師李美紅敢啦

在鄉下念小學時,

班上有位女同學叫 李美紅

她不怕蟑螂還可以徒手抓 甚至把死蟑螂拿去垃圾桶丟,

因此同學都很欽佩她

有一天老師在課堂上提到說 :「每個人的人生中,都有會害怕的時候 ,像老師就很怕蟑螂,請問你們有沒有人敢抓蟑螂的呢?」小明很快地舉手搶答~

用那不太流利的國語回答 「老師李美紅敢啦!」

.
然後 小明就在訓導處了

MariaDB的主從架構建置

Mariadb主從架構建置

一、資料庫安裝

  1. 至Mariadb官網下載安裝來源設定檔

  2. 將該檔上傳至主機

  3. 執行來源安裝檔


  4. 安裝mariadb-server

    yum install mariadb-server

  Erasing    : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                                                                    14/14 
  Verifying  : MariaDB-server-10.4.13-1.el7.centos.x86_64                                                                                                                             1/14 
  Verifying  : MariaDB-compat-10.4.13-1.el7.centos.x86_64                                                                                                                             2/14 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                      3/14 
  Verifying  : boost-program-options-1.53.0-28.el7.x86_64                                                                                                                             4/14 
  Verifying  : MariaDB-client-10.4.13-1.el7.centos.x86_64                                                                                                                             5/14 
  Verifying  : lsof-4.87-6.el7.x86_64                                                                                                                                                 6/14 
  Verifying  : MariaDB-common-10.4.13-1.el7.centos.x86_64                                                                                                                             7/14 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                            8/14 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                             9/14 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                                                                           10/14 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                   11/14 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                       12/14 
  Verifying  : galera-4-26.4.4-1.rhel7.el7.centos.x86_64                                                                                                                             13/14 
  Verifying  : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                                                                    14/14 

Installed:
  MariaDB-compat.x86_64 0:10.4.13-1.el7.centos                                                 MariaDB-server.x86_64 0:10.4.13-1.el7.centos                                                

Dependency Installed:
  MariaDB-client.x86_64 0:10.4.13-1.el7.centos  MariaDB-common.x86_64 0:10.4.13-1.el7.centos  boost-program-options.x86_64 0:1.53.0-28.el7  galera-4.x86_64 0:26.4.4-1.rhel7.el7.centos 
  lsof.x86_64 0:4.87-6.el7                      perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7   perl-DBI.x86_64 0:1.627-4.el7               
  perl-IO-Compress.noarch 0:2.061-2.el7         perl-Net-Daemon.noarch 0:0.48-5.el7           perl-PlRPC.noarch 0:0.2020-14.el7            

Replaced:
  mariadb-libs.x86_64 1:5.5.64-1.el7                                                                                                                                                       

Complete!

二、防火牆設定

  1. 新增3306port 的服務

    firewall-cmd --add-port=3306/tcp --perm
  2. 重啟防火牆

    firewall-cmd --reload

三、主資料庫設定

  1. 啟用Mariadb

    #systemctl enable mariadb
    Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    
    #systemctl start mariadb
  2. 建立root密碼或變更管理者密碼 1或2任選一個

    1.mysql_secure_installation
    過程說明:
    輸入root密碼,預設為空
    設定root密碼[Y/n]?不要為了方便跟OS的root相同…
    移除匿名使用者[Y/n]?Y
    是否禁止root遠端登入[Y/n]?Y,建議禁止
    刪除測試用資料[Y/n]?Y
    重新載入權限[Y/n]?Y
    
    2.mysqladmin -u root password

  3. 修改/etc/my.cnf

    #vi /etc/my.cnf

    加入以下設定

    [mysqld]
    server-id=1
    log_bin=master-bin
    binlog-ignore-db=mysql
    binlog-ignore-db=information_schema
    binlog-ignore-db=performance_schema
    binlog-ignore-db=test
    innodb_flush_log_at_trx_commit=1
    binlog_format=mixed

    備註:此配置一定要在[mysqld]之下

    重啟服務

    #systemctl restart mariadb
  4. 新增備份帳號 登入mariadb

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 

    新增備份帳號bkuser

    MariaDB [(none)]>grant replication slave on *.* to 'bkuser'@'%' identified by '123456';
    Query OK, 0 rows affected (0.005 sec)
  5. 秀出master現況

    MariaDB [(none)]>show master status\G
    *************************** 1. row ***************************
                File: master-bin.000001
            Position: 329
        Binlog_Do_DB: 
    Binlog_Ignore_DB: mysql,information_schema,performance_schema,test
    1 row in set (0.001 sec)

四、從資料庫設定

  1. 前面一、二、三、1.2.都依照前面所述 ,依樣畫葫蘆

  2. 修改/etc/my.cnf

    [mysqld]
    server-id=2
    relay-log-index=slave-relay-bin.index
    relay-log=slave-relay-bin
    relay_log_recovery=1

    重啟mariadb

    #systemctl restart mariadb
  3. 設定同步主資料庫 進入mysql

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 

    先停用slave

    MariaDB [(none)]>stop slave;

    設定同步主資料庫資訊

    MariaDB [(none)]>change master to 
                     master_host='192.168.7.132',        <-master資料庫主機IP
                     master_user='bkuser',               <-前面三4設定的備份帳號
                     master_password='123456',           <-前面三4設定的備份帳號密碼
                     master_log_file='master-bin.000001',<-前面三5所查出的檔名編號
                     master_log_pos=329;                 <-前面三5所查出的LOG編號

    啟用slave

    MariaDB [(none)]>start slave;
  4. 秀出slave現況

    MariaDB [(none)]> show slave status\G
    *************************** 1. row ***************************
                    Slave_IO_State: Waiting for master to send event
                       Master_Host: 192.168.7.132
                       Master_User: bkuser
                       Master_Port: 3306
                     Connect_Retry: 60
                   Master_Log_File: master-bin.000001
               Read_Master_Log_Pos: 329
                    Relay_Log_File: slave-relay-bin.000004
                     Relay_Log_Pos: 556
             Relay_Master_Log_File: master-bin.000001
                  Slave_IO_Running: Yes
                 Slave_SQL_Running: Yes
                   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: 329
                   Relay_Log_Space: 865
                   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: 0
     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: 1
                    Master_SSL_Crl: 
                Master_SSL_Crlpath: 
                        Using_Gtid: No
                       Gtid_IO_Pos: 
           Replicate_Do_Domain_Ids: 
       Replicate_Ignore_Domain_Ids: 
                     Parallel_Mode: conservative
                         SQL_Delay: 0
               SQL_Remaining_Delay: NULL
           Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
                  Slave_DDL_Groups: 0
    Slave_Non_Transactional_Groups: 0
        Slave_Transactional_Groups: 0
    1 row in set (0.001 sec)
    

    看到紅框的部份都出現Yes , 表示已經連上master,並且開始同步

五、驗證

  1. 於master新增資料庫及資料 登入master

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>

    新增一個資料庫

    MariaDB [(none)]>CREATE DATABASE ICW01;
    Query OK, 1 row affected (0.002 sec)

    進入ICW01後再新增一個資料表

    MariaDB [(none)]> USE ICW01;
    Database changed
    MariaDB [ICW01]> CREATE TABLE my_table ( data  varchar(255))
        -> ENGINE=InnoDB DEFAULT CHARSET=utf8;
    Query OK, 0 rows affected (0.027 sec)

    再新增一筆資料備查

    MariaDB [ICW01]> INSERT INTO my_table (data) VALUES ('I will be  successful!');
    Query OK, 1 row affected (0.006 sec)

    再秀一下master狀態

    MariaDB [ICW01]> show master status\G
    *************************** 1. row ***************************
                File: master-bin.000001
            Position: 850
        Binlog_Do_DB: 
    Binlog_Ignore_DB: mysql,information_schema,performance_schema,test
    1 row in set (0.001 sec)

    發現LOG已經增加為850

  2. 於slave去查詢master所新增的資料 登入slave

    #mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 10
    Server version: 10.4.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>

    秀slave狀態

    MariaDB [(none)]> show slave status\G
    *************************** 1. row ***************************
                    Slave_IO_State: Waiting for master to send event
                       Master_Host: 192.168.7.132
                       Master_User: bkuser
                       Master_Port: 3306
                     Connect_Retry: 60
                   Master_Log_File: master-bin.000001
               Read_Master_Log_Pos: 850
                    Relay_Log_File: slave-relay-bin.000004
                     Relay_Log_Pos: 1077
             Relay_Master_Log_File: master-bin.000001
                  Slave_IO_Running: Yes
                 Slave_SQL_Running: Yes

    發現它已經自動同步到850

    再秀一下現有的資料庫

    MariaDB [(none)]> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | ICW01              |
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    5 rows in set (0.002 sec)

    發現ICW01 已經出現在資料庫列表之中

    再去查詢裡面的資料是否正確

    MariaDB [(none)]> use ICW01;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    MariaDB [ICW01]> select * from my_table;
    +------------------------+
    | data                   |
    +------------------------+
    | I will be  successful! |
    +------------------------+
    1 row in set (0.001 sec)

    確認正確 !!

更換淨水器濾心

今天進行拓霖淨水器濾心更換, 共有二支濾心, 一支是樹脂(NT$800), 另一支是陶瓷 (NT$2,700) ,依照之前賣我的那個業務所說, 陶瓷的那支可以用乾淨的牙刷清洗後重覆使用, 所以….

拆下來更換時, 發現二管的日期居然不一樣, 這幾年來都是叫廠商派人來更換, 第一年更換後, 出水量有明顯變大, 但去年更換後卻沒有改變, 我就懷疑被偷工減料, 今天一看, 明明就一起換, 也收二管的錢, 怎麼會不同日期, 果然只有二老人家在家, 更換的工人有偷工減料, 陶瓷的那管沒換, 我心裡是這樣認為.

但當我換下來陶瓷的那管, 拿去清洗, 發現也沒怎麼髒, 沖沖水又裝回去, 只更換了樹脂的那管,  當換好後送水, 測試出水時, 發現只換樹脂的那管, 出水也明顯變大了.

該死的更換工人, 難道去年二管都沒換, 前年也可能只換樹指濾心 , 每年都還收我NT$3,800元 , 真是可惡!

nginx 無法正常顯示未加斜線的網址

nginx 無法正常顯示未加斜線的網址

server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;

index index.html;

location / {
add_header x-uri $uri;
try_files $uri $uri/ @rewrites;
}

location @rewrites {
rewrite ^\/([a-zA-Z0-9]+).*$ /$1/index.html last;
}

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control “public, must-revalidate, proxy-revalidate”;
}

}

結果將 $uri/  拿掉後重啟就正常了

油價歷史新低點

因為武漢肺炎疫情, 最近很多公司都居家上班, 尖峰時段車子也少很多, 世界各國都很嚴重,所以油價下跌, 因為需求量減少.

這週的油價來到歷史新低點, 92無鉛17.3元/升;95無鉛18.8元/升 , 今天去加油46公升多, 才838元, 這是多久沒見到過的金額了, 下週又要上漲0.6元了, 這個油價只能當作紀念, 應該很難再出現, 18.8元, 881囉~

修改推甄文檔

昨天接到蛇您吶的電話, 說苡璇的推甄文件因為太大而無法上傳, 而且已經是最後一天了, 要我儘快協助, 問清檔案格式, 原來是PPT, 心裡猜想可能是照片問題

到了現場果然是照片, 每一張都1M多, 當然超過5M, 而且還要把PPT滙出成為PDF

教苡璇修改照片尺寸, 以減小容量, 並且在滙出時不要採用最高品質, 以降低檔案大小, 但前提是要看得清楚為主, 修改後滙出檔案只剩下3.2M

收工回家

停用信用卡

今天把二張信用卡停卡了, 因為加辦了一張LINE PAY, 所以把中信的金卡給停了, 不過LINE PAY 是一卡通, 便利商店雖然可以用, 但有些商店還是沒支援, 像今天去的羽臨創意拉麵就只能悠卡

所以今天停掉了中信的悠遊卡和玉山家樂福的i-cash卡, 銀行說要40天才會退款, 到時再留意了

Line Pay信用卡

前天收到新申請的Line Pay信用卡, 昨天下班前把它綁定手機上的Line Pay (因為回家收不到簡訊,  只好在下班離開公司前綁定它, 可收認證簡訊 => 綁定OK

今天去全聯買台灣鳳梨49元, 就刷Line Pay 卡, 果然在Line上收到1%的回饋, 還在研究怎麼用它

因為它不是悠遊卡, 而是一卡通, 不知道在便利商店能不能使用, 還要等試過才知道.