EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

mariadb tunning


character-set-server = utf8mb4

#tunning
skip_name_resolve = 1


open_files_limit  = 65535
max_connect_errors = 1000000
table_open_cache = 1024
table_definition_cache = 1024
#table_open_cache_instances = 64  #MySQL 5.6
sort_buffer_size = 4M
join_buffer_size = 4M
interactive_timeout = 600
wait_timeout = 600
tmp_table_size = 32M
max_heap_table_size = 32M
#master_info_repository = TABLE  #MySQL 5.6
#relay_log_info_repository = TABLE  #MySQL 5.6
#gtid_mode = on
#enforce_gtid_consistency = 1
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
lock_wait_timeout = 3600
#explicit_defaults_for_timestamp = 1  #MySQL 5.6

innodb_thread_concurrency = 0
innodb_sync_spin_loops = 100
innodb_spin_wait_delay = 30
transaction_isolation = REPEATABLE-READ
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2867M
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
#innodb_data_file_path = ibdata1:1G:autoextend
#正確做法,如果原本己經有了  http://www.cnblogs.com/ivictor/p/5340822.html
#innodb_data_file_path = ibdata1:原始大小;ibdata2:1G:autoextend

innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
#innodb_max_undo_log_size = 4G

innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
#innodb_page_cleaners = 4
innodb_open_files = 65535
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32
#innodb_file_format = Barracuda
#innodb_file_format_max = Barracuda
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_online_alter_log_max_size = 4G
#ineinternal_tmp_disk_storage_engine = InnoDB
innodb_status_file = 1
innodb_status_output = 1
innodb_status_output_locks = 1
innodb_stats_on_metadata = 0

#performance_schema
performance_schema = 1
performance_schema_instrument = '%=on'

#innodb monitor  5.7後禁用
#innodb_monitor_enable="module_innodb"
#innodb_monitor_enable="module_server"
#innodb_monitor_enable="module_dml"
#innodb_monitor_enable="module_ddl"
#innodb_monitor_enable="module_trx"
#innodb_monitor_enable="module_os"
#innodb_monitor_enable="module_purge"
#innodb_monitor_enable="module_log"
#innodb_monitor_enable="module_lock"
#innodb_monitor_enable="module_buffer"
#innodb_monitor_enable="module_index"
#innodb_monitor_enable="module_ibuf_system"
#innodb_monitor_enable="module_buffer_page"
#innodb_monitor_enable="module_adaptive_hash"



key_buffer_size = 32M #16M
max_allowed_packet = 32M #16M
thread_stack = 512K #192K
thread_cache_size       = 150 #8


myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10



query_cache_type = 0
query_cache_limit = 1M
query_cache_size        = 0 #16M




slow_query_log = 1
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 1
log_slow_rate_limit = 1000
log_slow_verbosity = query_plan




server-id               = 3306
log_bin = /var/log/mysql/mysql-bin.log
sync_binlog = 1
expire_logs_days = 7
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
binlog_format = row
relay_log_recovery = 1
relay-log-purge = 1


程序猿都该知道的MySQL秘籍 - 叶金荣@-----
thread_handling=pool-of-threads

http://www.cnblogs.com/nocode/archive/2013/05/25/3098317.html


-----
檔案系統 xfs > ext4 >ext 2 or 3


innodb_buffer_pool_size  約物理內存的50%~70%

innodb_data_file_path  分始化大小至少1G

innodb_log_file_size 1G以上


innodb_flush_log_at_trx_commit  0=>最快、數據最不安全, 1=>最慢最安全, 2=>折中

innodb_max_dirty_pages_pct  25~50(25%~50%)為宜

innodb_io_capacity  HDD=>1,000左右,SSD=>10,000左右,PCIe SSD=>20,000以上
**kernel io scheduler  => dedline    SSD=>noop  


key_buffer_size  32M以下

sync_binlog  0=>最快,數據最不安全,系統自決定刷新binlog的頻率;1=>最慢最安全,每個event刷新一次;N=>每N個事務刷一次binglog

long_query_time  建議設置小于0.5秒

open_files_limit & innodb_open_files  建議65535


max_connections 突發最大連接數的80%為宜,過大容易導致全部卡死

query_cache_size=0 & query_cache_type=0 關閉


-----
http://imysql.com/2016/03/11/mysql-faq-why-ibdata1-size-growup.shtml

ibdata1 文件儲存了什麼內容?

Data dictionary

Double write bufer

Insert buffer

Rollback segments

UNDO space

Foreign key constraint system tables


但當 啟用獨立表空間,ibdata1只存放系統數據

innodb_file_per_table = 1



-----
連接數過高

大部份的不正確做法:殺掉多餘的連接,加人連接數

正確做法:

.限制連接數: max_user_connections



-----
http://imysql.com/2016/01/13/mysql-optimization-case-howto-find-performance-bottleneck.shtml

檢查指令

vmstat -S m 1

sar -d 1    or   w

iotop



 mysqladmin pr|grep -v Sleep

-----
http://imysql.com/2015/12/30/mysql-faq-howto-stat-response-time-shtml.shtml



http://imysql.com/2015/11/04/mysql-faq-some-important-in-explain.shtml

explain


-----
http://imysql.com/category/%E6%95%B0%E6%8D%AE%E5%BA%93/page/3



将操作日志记入syslog并且发送到远程log server上,坚决不能只存储在本地;

设置密码安全策略,MD5之后再作为正式密码,32位长度的安全程度够高吧;

应用账号只赋予SELECT、UPDATE、INSERT权限,取消DELETE权限。把需要DELETE权限的逻辑改成用UPDATE实现,避免被物理删除;

需要真正删除时,交由DBA先备份后再物理删除;



-----
https://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/


-----
Monitor MySQL Performance
https://www.tecmint.com/mysql-performance-monitoring/


  • Mytop

https://www.packtpub.com/mapt/book/application_development/9781783981601/2/ch02lvl1sec25/mytop

http://15jb.net/mariadb%E6%80%A7%E8%83%BD%E8%AA%BF%E5%84%AA%E5%B7%A5%E5%85%B7mytop%E7%9A%84%E4%BD%BF%E7%94%A8%E8%A9%B3%E8%A7%A3

  • innotop



  • mysqlsla

https://www.packtpub.com/mapt/book/application_development/9781783981601/2/ch02lvl1sec27/mysqlsla


  • mysqladmin status



  • MySQL性能查询脚本

http://www.cnblogs.com/ivictor/p/5345217.html


==============SQL===============

SHOW GLOBAL VARIABLES where
Variable_Name in (
'table_open_cache',              
'table_definition_cache',        
                                 
'sort_buffer_size',              
'join_buffer_size',              
'interactive_timeout',            
'wait_timeout',                
'tmp_table_size',
'max_heap_table_size',            
'read_buffer_size',              
'read_rnd_buffer_size',          
'bulk_insert_buffer_size',        
'lock_wait_timeout',              
                                 
'innodb_thread_concurrency',      
'innodb_sync_spin_loops',      
'innodb_spin_wait_delay',      
'transaction_isolation',            
'innodb_additional_mem_pool_size',  
'innodb_buffer_pool_size',          
'innodb_buffer_pool_instances',    
'innodb_buffer_pool_load_at_startup',
'innodb_buffer_pool_dump_at_shutdown',
'innodb_flush_log_at_trx_commit',  
'innodb_log_buffer_size',          
'innodb_log_file_size',            
'innodb_log_files_in_group',        
                                 
'innodb_write_io_threads',          
'innodb_read_io_threads',          
'innodb_purge_threads',            
'innodb_open_files',                
'innodb_max_dirty_pages_pct',      
'innodb_flush_method',              
'innodb_lru_scan_depth',
'innodb_checksum_algorithm',        
'innodb_lock_wait_timeout',        
'innodb_rollback_on_timeout',
'innodb_print_all_deadlocks',
'innodb_file_per_table',            
'innodb_online_alter_log_max_size',
'innodb_status_file',              
'innodb_status_output',
'innodb_status_output_locks',      
'innodb_stats_on_metadata',        
                                 
'performance_schema',              
'performance_schema_instrument',



'key_buffer_size',    
'max_allowed_packet',
'thread_stack',  
'thread_cache_size',  
                   
                   
'query_cache_type',
'query_cache_limit',
'query_cache_size',  
                   
'server-id',          
'log_bin',      
'sync_binlog',        
'expire_logs_days',
'binlog_cache_size',
'max_binlog_cache_size',
'max_binlog_size',    
'binlog_format',      
'relay_log_recovery',
'relay-log-purge'    

)

docker Kubernetes

http://www.uuread.cc/cfaqxcQc.html


Kubernetes具備超強的故障恢復機制,Kubernetes會重啟意外停止的pod。我們曾遇到過因記憶體洩露,導致容器在一天內宕機多次的情況,然而令人驚訝的是,甚至我們自己都沒有察覺到。





資料儲存


以我們的情況,在Kubernetes內執行資料儲存沒有想象中那麼完美,設定起來也比其他Kubernetes部署複雜得多。

於是我們決定不在生產環境資料儲存上使用Kubernetes,而是選擇在不同的機器上手動啟動這些叢集,我們在Kubernetes內部執行的應用正常連線到資料儲存叢集

optimizing mysql for high concurrency on amazon

http://tech.noredink.com/post/133347435578/optimizing-mysql-for-high-concurrency-on-amazon


  • Looking for concurrency bottlenecks
    • performance schema
      • List the total maximum wait by event inside of InnoDB
        SELECT EVENT_NAME, SUM_TIMER_WAIT/1000000000 WAIT_MS, COUNT_STAR FROM performance_schema.events_waits_summary_global_by_event_name ORDER BY SUM_TIMER_WAIT DESC, COUNT_STAR DESC LIMIT 30;
      • List current and last wait events on InnoDB.
        -- "what the current, or last completed, wait for each session was, and for exactly how long they waited" SELECT NAME, IF(PPS.THREAD_ID = 0, 'Internal Thread', CONCAT(IPS.USER, '@', IPS.HOST)) USER, DB, COMMAND, STATE, TIME, EVENT_NAME LAST_WAIT, IF(TIMER_WAIT IS NULL , 'Still Waiting', TIMER_WAIT/1000000000) LAST_WAIT_MS FROM performance_schema.events_waits_current JOIN performance_schema.threads PPS USING (THREAD_ID) LEFT JOIN INFORMATION_SCHEMA.PROCESSLIST IPS ON IPS.ID = PPS.THREAD_ID;
  • Disabling the query cache
  • Increasing InnoDB thread concurrency
  • Increasing InnoDB open tables

database performance aws vs bare metal

https://medium.com/devoops-and-universe/database-performance-aws-vs-bare-metal-452f64481b07



mariadb Performance Schema

https://mariadb.com/kb/en/mariadb/performance-schema-overview/

1萬pc



準系統 2017/04/15

http://www.coolpc.com.tw/tmp/1492164432391274.htm




https://www.mobile01.com/topicdetail.php?f=396&t=5120761



===========
1萬nb

http://pcdvd.com.tw/showthread.php?t=1123368






會去美國eBay撿便宜
像是Dell Latitude E6430 【Manufacturer refurbished】不用美金250元

第三代IvyBrideg I5-3320M 絕對夠用,又是rPGA針腳(不是焊死的BGA)
內行的就知道了

純正商務筆電血統穩定品質大勝台灣萬元筆電

加上Latitude零件流通性不比ThinkPad差,淘寶一堆

MySQLTuner

https://github.com/major/MySQLTuner-perl

ispconfig performace Optimize





http://www.digitalfaq.com/forum/guides-ispconfig/3261-how-optimize-ispconfig.html





vi /etc/postfix/main.cf

# content_filter = amavis:[127.0.0.1]:10024
# receive_override_options = no_address_mappings

/etc/init.d/postfix restart



/etc/init.d/clamav-daemon stop 
/etc/init.d/clamav-freshclam stop 
/etc/init.d/spamassassin stop
/etc/init.d/amavis stop


update-rc.d -f clamav-daemon remove 
update-rc.d -f clamav-freshclam remove 
update-rc.d -f spamassassin remove 
update-rc.d -f amavis remove

ispconfig & auto install

https://github.com/servisys/ispconfig_setup


好用

gps

https://www.ptt.cc/bbs/MobileComm/M.1430233385.A.583.html


BCM 47531A1 五模衛星GPS晶片

BRCM 4774



ASUS 551ML

榮耀6 plus/魅族 MX4 Pro?/三星 Note4

離線下載

offcloud.com

telegram-cli

https://github.com/vysheng/tg


https://my.telegram.org/auth?to=apps

https://www.youtube.com/watch?v=On9yeMtG2Wg
https://core.telegram.org/bots/samples
https://www.91yun.org/archives/5691




建議

1、人口結構:大量外勞引進,補充基礎人力,才能擴增中上層人口,外勞法法令完備化。

2、能源結構:核能主,天然輔,核能安全檢修嚴格化。

3、休生養息:不跟美國買軍備、不信日本、跟大陸50年不獨不靠台商,靠觀光,50年 時間換空間  連結 10分

remove windows app store app 除 小算盤

https://steachs.com/archives/14897
https://tatmingstudio.blogspot.tw/2015/08/Windows10-Metro-App-Crash-Fix.html


Get-AppxPackage *windowscalculator* | Remove-AppxPackage


Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *getstarted* | Remove-AppxPackage
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Get-AppxPackage *zunevideo* | Remove-AppxPackage
Get-AppxPackage *bingnews* | Remove-AppxPackage
Get-AppxPackage *onenote* | Remove-AppxPackage
Get-AppxPackage *people* | Remove-AppxPackage
Get-AppxPackage *windowsphone* | Remove-AppxPackage
Get-AppxPackage *photos* | Remove-AppxPackage
Get-AppxPackage *windowsstore* | Remove-AppxPackage
Get-AppxPackage *bingsports* | Remove-AppxPackage
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
Get-AppxPackage *bingweather* | Remove-AppxPackage

k2斐讯 psg1218 己breed (recovery)






1、設ip: 192.168.1.10

No GateWay



2、拔掉K2斐訊電源,持續按著K2斐訊後wps按鍵,同時插上電源,至少20秒


3、打開瀏覽器進入192.168.1.1



==========


http://www.right.com.cn/forum/thread-187561-1-1.html


ionic2 Messaging Push

簡單來說:

getDeviceToken 方法有三:

一、ionic Native Push (https://ionicframework.com/docs/v2/native/push/)

二、ionic Native Firebase (https://ionicframework.com/docs/v2/native/firebase/)

三、cordova FCM plugin (https://github.com/fechanique/cordova-plugin-fcm)

之前試用的方式是:
http://sueboy.blogspot.tw/2017/01/ionic2-fcm-send-message-to-device-token.html


.AngularFire2  authstate.auth.getToken()  is  JWT token for firebase

ionic always update for best New || Speed up initial loading

https://github.com/driftyco/ionic/issues/6776#issuecomment-267961514
https://github.com/driftyco/ionic-app-scripts/issues/596

This problem.... just update

>> ionic info

Ionic Framework
Ionic CLI
Ionic App Lib
Ionic App Scripts

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.1

So
1、npm update to best new

npm update -g


2、uninstall ionic

npm uninstall ionic


3、install ionic

npm install -g ionic


4、update package.js  in project

npm install -g npm-check-updates
npm-check-updates
npm-check-updates -u
npm install

or only check

npm outdated


5、update ionic-native  (maybe npm-check-updates update to new)

npm update ionic-native


6、maybe
ionic state reset


Finial Step:

ionic info

and

ionic start new-project-for-check-update blank --v2

see package.json  is laste new


ok~~


.developer

ionic run android --prod


.release

ionic build android --release --prod


Usually app start down then 1s for black screen

Error: Current working directory is not a Cordova-based project.

https://github.com/driftyco/ionic-cli/issues/935

just put www directory on root

ionic2 icons splashscreen 產生圖片

https://gxiangco.gitbooks.io/m3-app-dev/content/part4/%E6%9B%B4%E6%8F%9Bicons%E5%8F%8Asplashscreen.html

1、 change resource icon.png and splash.png

2、ionic resources  

3、check resource android and ios images is changed ?

4、apk
4.1、 ionic platform remove android  then  ionic platform add  android
or
4.2、
ionic build android
copy res android and ios images to platform/android or ios inside

ionic2 PhotoViewer local file

https://ionicframework.com/docs/v2/native/photo-viewer/

follow step just do.


Now focus

https://github.com/sarriaroman/photoviewer/issues/11

ps:   declare var cordova: any;
ps2: cordova plugin add cordova-plugin-file

www/assets/img  is ionic2 now version, maybe future change, but now this is correct

  showImage(imageUrl) {
    if (this.platform.is('cordova') && this.platform.is('android')) {
      File.readAsDataURL(cordova.file.applicationDirectory + "www/assets/img/", imageUrl)
      .then((dataURL:string) => {
        PhotoViewer.show(dataURL, "", {share: false})
      })
      .catch(
        (err)=>{alert("err: "+err)
      });
    } else if (this.platform.is('cordova') && this.platform.is('ios')) {
      PhotoViewer.show(cordova.file.applicationDirectory + "www/assets/img/"+imageUrl);
    }
  }


https://github.com/apache/cordova-plugin-file


==========
https://www.npmjs.com/package/ionic-img-viewer

this.app can't find in app

import { App } from 'ionic-angular';

[轉]MVC是一個巨大誤會

http://blog.turn.tw/?p=1539

View

  • Model 2: 不具有行為,只是等別人塞資料進去的模板(template)。
  • MVC: 具有監視Model的行為,並以此去改變呈現(presentation)。

Controller

  • Model 2: 接收請求與參數,轉交給Model處理,再把結果(最新的資料)塞進View。
  • MVC: 接收請求與參數,轉交給Model處理。沒其他事了。

Model

  • Model 2: 接收Controller傳來的參數,回傳結果。
  • MVC: 接收Controller傳來的參數,將結果通知View

rxjava

https://www.zybuluo.com/cxm-2016/note/467206

==========
http://www.itread01.com/articles/1476290449.html


Operators一句話介紹(RxJava版)



Cold Observables

在第一個subscriber訂閱後才執行事件發送的Observables,默認普通Observables都是這個類型
Cold Observables對於每個訂閱的subscriber執行一次事件發送過程的重演,每次事件實體將重新生成,尤其對於每次隨機生成的數值將不保證保持一致性
參考:Observable vs ConnectableObservable
Hot Observables

從創建一刻開始立即發送事件,此後進行訂閱的subscribers僅能接收在訂閱後發送的事件
Hot Observables發送的事件實體對象在所有subscribers之間進行共享
Connectable Observables

在connect()調用時進行事件發送動作,不論是否有subscriber執行了訂閱。實際上是把該Observable轉換為Hot Observable,發送的事件實體對象在所有subscribers之間進行共享


Creating

create / just(T..) / from(Iterable/Array) 常用Observable構建方式
defer(Func0) 延遲生成Observable,每次subscribe時生成新的Observable
range(start, len) 發送從start開始的數字序列,長度為len,值區間為[start, start+len-1]
repeat(n) 非直接構造器,將上個構造好的Observable重復n次發送(前一次Observable發送onCompleted後再啟動下一次的重訂閱),不傳參時表示無限repeat
repeatWhen(Func1<Observable<Void>, Observable) 通過函數判斷是否進行下一次重訂閱,可參考retryWhen(Func1)解釋
interval(time) 周期性發送一個序號數字(從0開始的正整數序列順序)
timer(time) 在指定時間後發送數字0


Transforming


map(Func1) / cast(class) 將單個事件轉型為另一類型事件或據此構造新的次級Observable並匯入單一事件流
flatMap / flatMapIterable 依據單個事件構造新的次級Observable或Iterable並匯入單一事件流,flatMap不保證發送順序 (允許交叉發送)
concatMap / switchMap concatMap是有序化版本的flatMap,switchMap是強時效版本的flatMap(下個次級Observable開始發送事件時,前面的次級Observable將自動被終止發送)
buffer(count/time) 按數量、時間緩存前後多個事件為一個個小組,再按小組為單位逐次發送
window(count/time) 類似於buffer,但緩存的小組以子Observable形式作為事件發送 (需要二次subscribe分發)
groupBy(KeyFunc, ValueFunc) 通過函數獲得每個事件的Key值進行分組,並將事件轉換為Value類型,返回發送GroupedObservable類型事件的包裹Observable (需要二次subscribe分發)
scan(Func2(x1, x2)) 前一次實際發送的事件x1與本次該發送的源事件x2通過函數計算,其結果作為本次實際發送的的事件,第0個初始事件不經過函數直接發送


Filtering


filter(Func1) 通過函數判斷事件是否可發送
throttleWithTimeout(time) / debounce(time) 每次事件發送時啟動獨立時效計時器,計時結束前有新事件發送則拋棄舊事件並重新啟動計時,計時結束後事件未被拋棄才執行實際發出
debounce(Func1) 以函數返回的臨時Observable的(虛擬)事件發送完畢為時間標記點進行事件有效計時判斷。本次事件產生的臨時Observable發送結束前未有新的臨時Observable產生並發送,則本次事件執行實際發出
throttleFirst(time) 發送每個時間周期片段內第一個發送的事件
sample(time) / throttleLast(time) 發送每個時間周期片段內最後一個發送的事件
distinct 去除事件集合中的所有重復項
distinctUntilChanged 去除事件集合中連續重復部分的重復項 (允許ABAB交叉發送)
skip(count) / skipLast() 拋棄前面/後面n個事件
take(count) / takeLast(count) 僅發送前面/後面n個事件
first(Func1) / last(Func1) 僅發送首個、最後一個滿足函數條件的事件
elementAt(index) 僅發送指定下標位置的事件
firstOrDefault() / lastOrDefault() / elementAtOrDefault() 在事件數量不足時,發送一個默認代替事件
ofType(class) 僅發送指定子類型的事件
ignoreElements() 刪除所有事件的發送,僅發送 onCompleted / onError 結束通知


Combining


startWith(T.../Iterable/Observable) 在事件發送前追加優先發送的事件
merge(Observable...) 最簡單的事件組合操作符,將任意多個Observable發送的事件混合到單一事件流中(類似flatMap),所有Observable發送的事件類型必須相同,允許交叉發送,任一成員Observable發送 onError 時,將終止其他所有Observable的事件發送
meregeDelayError(Observable...) onError 事件會緩存到merge結束後發送的版本
concat 每個Observable按加入順序發送的merge版本
switchOnNext(Observable<Observable>) 將一個發送多個次級Observable的父Observable轉換為單一事件流的Observable(類似flatMap),當下一個子Observable被父Observable發送出來時,前一個子Observable將被終止發送事件 (可視為Observable構造器)
zip(Observable..., FuncN) 組合任意多個Observable的事件,每個成員Observable發送的第n次事件進行組合,通過FuncN函數合成出本次(第n次)發送的事件數據,事件合成、發送時機取決於最後一個發送第n次事件的成員Observable,任一成員Observable發送完畢時觸發整體發送 onCompleted 事件 (可視為Observable構造器)
zipWith(Iterable/Observable, Func2) 組合另一個Observable
combineLatest(Observable..., FuncN) 組合任意多個Observable最後一次發送的事件(每個Observable至少發送一次事件才有效),當任一成員Observable發送新事件時,將觸發一次FuncN函數將其他各Observable最後一次發送的事件進行組合,返回本次需要實際發送的事件對象
join(Observable, leftTimer, rightTimer, resultFunc) 當前Observable與目標Observable進行組合, leftTimer / rightTimer 函數產生一個用於判定時間窗口長度的臨時Observable,兩個Observable發送的事件在各自窗口期內遇到對方Observable發送新事件,則觸發 resultFunc 函數進行兩個事件的組合,產生本次發送的事件對象,同一窗口期內遇多次事件發送,則分別進行多次組合發送
groupJoin() 返回group組合的Observable對象作為事件的join版本


Error Handling


onErrorReturn(Func1) 發生錯誤時,發出一個替身事件取代異常拋出
onErrorResumeNext(Observable) 發生錯誤時,使用另一個替身Observable取代當前Observable繼續發送事件
onExceptionResumeNext(Observable) 發生Exception類型錯誤時,使用另一個替身Observable取代當前Observable繼續發送事件,否則將錯誤正常拋出到 onError 方法
retry(count/Func2) 通過次數或函數判斷是否需要重啟Observable(重訂閱),不滿足retry條件則將錯誤正常拋出到 onError 方法,不傳參時表示無條件retry
retryWhen(Func1<Observable<Throwable> errorOb, Observable notiOb>) 通過函數判斷是否進行下一次重啟Observable(重訂閱),函數需要返回一個以errorOb為根的Observable對象notiOb,若errorOb本次發送的Throwable事件(從源Observable的onError截獲)觸發notiOb發送 onNext 事件(發送事件類型無關)則觸發本次retry,若notiOb發送 onCompleted / onError 事件則不再觸發retry,此時將錯誤正常拋出到 onError 方法
可考慮通過errorOb.flatMap進行throwable->Observable的轉換,或通過zipWith(Observable.range)實現次數限制等,必須以errorOb作為返回的源Observable,直接返回errorOb時與簡單調用retry()效果相同

參考:對RxJava中.repeatWhen()和.retryWhen()操作符的思考


Utility


delay(time) / delaySubscription(time) 延遲事件發送 / 訂閱的過程
timeout(time) 對每個發送的事件設置超時計時器,計時結束時下個事件未被發出,則拋出超時異常等操作
timeInterval() 將發送的 onNext 事件替換為僅包含距離上次事件發送的時間間隔TimeInterval類型事件
timeStamp() 將發送的 onNext 事件與時間戳一起打包成Timestamped類型事件
do..(ActionX) 在Observable的生命周期的各個階段添加回調監聽動作
doOnEach = doOnNext + doOnError + doOnCompleted
doOnNext onNext 發生的時候觸發回調
doOnError onError 發生的時候觸發回調
doOnCompleted onCompleted 發生的時候觸發回調
doOnTerminate doOnError / doOnCompleted 後觸發,完成後觸發subscriber相關回調
finallyDo Observable結束後觸發回調
doOnSubscribe subscribe 執行時觸發回調
doOnUnsubscribe unsubscribe / onError / onCompleted 的時候觸發回調
doOnSubscribe -> doOnEach -> doOnNext -> subscriber.onNext -> doOnEach -> doOnCompleted -> doOnUnsubscribe
doOnEach -> doOnError -> doOnTerminate -> subscriber.onError -> finallyDo
materialize() 將每個事件(包括 onCompleted / onError )分別打包為一個Notification類型事件進行發送
dematerialize() materialize的反向操作
subscribOn/observerOn 線程指定
using(Func0<Resource> create, Func1<Resource, Observable> timer, Action1<Resource> dispose) 創建臨時性資源,通過timer返回的Observable的終止時間來控制資源有效期,資源到期後回調dispose方法進行銷毀
single / singleOrDefault 如果Observable發送超過一個事件,則拋出異常或發送指定的事件
serialize 強制Observable的所有事件以同步方式發送(杜絕同時發送多個事件的可能性)
cache 緩存所有發送過的事件實體對象,用於在將來添加訂閱的Subscribers中回放(使用舊的已發送過的事件對象,與ConnectableObservable的replay有區別),默認情況下不使用cache,則新添加訂閱的Subscriber會啟動新的Observable事件發送過程,使用同一個Observable對象以相同的過程發送新創建的事件對象


Conditional and Boolean 條件限定


all(Func1) 判斷所有發送的事件是否符合指定條件,並最終返回發送單一個Boolean類型事件
contains(T) 判斷是否發送過指定事件
exists / isEmpty 判斷Observable是否發送過事件
sequenceEqual(Observable, Observable) 判斷兩個Observable發送的事件序列(包括結束狀態)是否完全一致
amb(Observable...) / ambWith(Observable) 選取率先發送第一個事件的Observable作為源Observable進行事件發送,其他Observable將被拋棄
defaultIfEmpty() Observable沒有發送事件時,則發送一個指定默認事件
skipUntil(Observable mark) 當mark沒有發送事件前,忽略源Observable發出的一切事件
skipWhile(Func1) 當函數返回false前,忽略Observable發出的一切事件
takeUntil / takeWhile 與 skipUntil / skipWhile 相反


Aggregate 集合


concat 每個Observable按加入順序發送的merge版本
count 統計Observable一共會進行發射的事件總數,事件會被拋棄忽略,僅在最後發送一個統計結果事件
reduce(Func2(x1, x2)) 與scan相同的運算方式,但僅發送最終的單個結果事件
collect(Func0 collector, Action2 collection) 事件收集器,實際運作方式與reduce類似,通過collection方法將每個發送的事件收集到collector方法產生的集合對象,並僅在最後發送這個收集完畢的集合對象事件
toList / toSortedList / toMap / toMultimap 將所有發送的事件對象收集為List、Map等集合對象,並在最後進行一次集合事件發送


Blocking



阻塞型Observable,通過一系列Operators對事件數據的發射進行阻塞。
可通過 Observable.toBlocking() 或 BlockingObservable.from() 將普通Observable轉換為BlockingObservable
forEach 對每個發射的事件應用一個函數,該函數會被阻塞直到Observable完成
first 阻塞第一個事件的發射,直到Observable發射下一個事件(或結束事件)
firstOrDefault 如果Observable沒有發射下一個事件(或結束事件),則發射一個默認事件
last / lastOrDefault 阻塞最後一個事件的發射,直到Observable發射一個結束事件
mostRecent 返回一個指向最近發射的事件序列的iterable
next 返回一個指向下一個發射的事件的iterable,阻塞獲取直到Observable執行發射動作
latest 返回一個iterable,阻塞獲取直到Observable發射了一個iterable沒有返回的值,然後返回這個值
single / singleOrDefault 如果Observable發送超過一個事件,則拋出異常或發送指定的事件
toFuture Observable轉換為Future對象
toIterable / getIterator Observable發送的所有事件轉換為單一Iterable / Iterator對象


Connectable Observable



在connect()調用時進行事件發送動作的Observable
publish 將一個Observable轉換為ConnectableObservable
replay 將一個Observable轉換為ConnectableObservable,對於事件發送後新加入訂閱的Observer進行過去的事件發送過程的重放(發出新創建的事件實體對象,區別於cache),保證任何時間加入訂閱的Observer都能接收到完整的整個事件序列,可傳入一函數對源Observable轉換為一個事件變形的新Observable,可參數指定buffer大小以及timeout時長
connect 令一個ConnectableObservable開始進行事件發送
refCount 令一個ConnectableObservable以普通Observable方式發送事件(不再以connect方法為發送開始標記),但仍保持所有Observer之間共享事件實體對象(保持與ConnectableObservable的鏈接,但至少需要保留一個Observer訂閱)
share 相當於publish+refCount應用到一個Observable(至少需要存在一個Observer訂???),事件實體將在所有Observer之間進行共享


String Observable



StringObservable類提供的基於String類型事件的額外Operators
byLine 把源String事件進行統合再處理,通過換行符作為新String事件的分割位點,轉換為每一獨立行為單位的新事件序列
decode 將多字節字符流轉換為字節數組事件類型的Observable
encode 將字符串事件Observable轉換為字節數組Observable
from 將字符流或Reader對象轉換為字節數組或String類型Observable
stringConcat 將String事件類型Observable的所有String事件數據進行整合,以單一String形式整體發送
join 以stringConcat方式串聯源Observable的所有String事件,但以指定的String作為切分標記
split 將String事件類型Observable的所有String事件進行整合,並重新以正則表達式進行切分


其他輔助庫


rxjava-async 用於生成異步事件發送的Observables
rxjava-joins 提供額外的Observables組合機制,如 and(), then(), when()
rxjava-computation-expressions 提供額外的條件判斷Operators
rxjava-math 提供一系列用於數值型事件的簡單數學統計、分析結果Operators


參考:


木水川 - RxJava操作符
【譯】對RxJava中.repeatWhen()和.retryWhen()操作符的思考
ReactiveX - Operators By Category
RxJava - wiki

angularfire2 subscribe once

https://github.com/angular/angularfire2/issues/380


subscription.unsubscribe();


Observable.interval + take(1)


copy keep angularfire list

Maybe

Object.assign   but sub itme only reference


So JSON.parse(JSON.stringify(theObject))

ionic2 FCM send message to device token

1、ionic start sendnotify blank --v2

2、cordova plugin add cordova-plugin-whitelist

3、src/index.html
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline' *; object-src 'self'; style-src 'self' 'unsafe-inline'; media-src *">
4、ionic serve  

====if success=====

5、home.ts

add

import { Http, Headers, RequestOptions } from '@angular/http';
import 'rxjs/add/operator/map';

add   constructor(private http: Http


sendnotify_devicetoken(devictoken) {
      let url = 'https://fcm.googleapis.com/fcm/send';

      let headers = new Headers({ 
        'Content-Type': 'application/json',
        'Authorization': 'key=your key'
      });
      let options = new RequestOptions({ headers: headers });

      let body = {
        "notification":{
          "title":"Notification title",
          "body":"Notification body",
          "sound":"default",
          "click_action":"FCM_PLUGIN_ACTIVITY",
          "icon":"fcm_push_icon"
        },
        "data":{
          //"param1":"value1",
          //"param2":"value2"
        },
        //"to":"/topics/topicExample",
        "to": devictoken,
        "priority":"high",
        "restricted_package_name":""
      };


      this.http.post(url, body, options).map(
          (res) => {return res}//res.json()
      ).subscribe(
          data => {
            alert(data);
          },
          err => {
            alert("ERROR!: "+err);
          }
      );

a. devictoken: see http://sueboy.blogspot.tw/2017/01/ionic2-fcm-get-device-token.html

b. your key:firebase console -> project setting -> cloud messaging ->
have two new and old api key.   Use new is better

6、ionic serve  push button, then send success

ionic2 FCM get device token

https://github.com/fechanique/cordova-plugin-fcm

1、 ionic start getdevicetoken blank --v2

2、ionic plugin add cordova-plugin-fcm --save

3、 firebase console  -> project setting -> add your project

 a. package name: copy from config.xml id="com.ionicframework.getdevicetokenxxxxxx"

 b. add project then  download google-services.json

4、put google-services.json  on getdevicetoken directory,  don't put getdevicetoken/platforms/android or ..../ios

5、ionic run android  ( remeber open  android emule)

=====If success, contiune=====
6、src/pages/home

a.  home.html replace <ion-content
  <ion-list>
    <ion-item>
      <ion-textarea  rows="6" [value]="devicetoken"></ion-textarea>
    </ion-item>
    <button ion-button (click)="getdevicetoken()">
      getdevicetokens
    </button>
    <button ion-button (click)="showdevicetoken()">
      showdevicetoken
    </button>  
    <button ion-button (click)="Notification()">
      Notification
    </button>
 
  </ion-list>

b.  home.ts

  •  before @Component  put

declare var FCMPlugin;


  •  replace export class HomePage{

  devicetoken: string;

  constructor(public navCtrl: NavController) {
    FCMPlugin.onNotification((data) => {
      if(data.wasTapped){
        //Notification was received on device tray and tapped by the user.
        alert( JSON.stringify(data) );
      }else{
        //Notification was received in foreground. Maybe the user needs to be notified.
        alert( JSON.stringify(data) );
      }
    }, (msg) => {
      alert("notification msg:"+msg);
    }, (err) => {
      alert("notification err:"+err);
    });
  }

  getdevicetoken(){
    FCMPlugin.getToken((token) => {
        this.devicetoken = token;
    }, (err) => {
      alert("getdevicetoken err:"+err);
    });
  }

  showdevicetoken(){
    alert(this.devicetoken);
  }

  Notification(){
    
  }


7、save, ionic run android
a. getdevicetoken
b. showdevicetoken  then copy devicetoken

8、firebase console -> Notifications -> add send message ->
a. put message text
b. chosses deivce (single deivce) put devicetoken
c. send

9、receive msg on android emule: two way front、background receive~


ionic2 google map

Must Remeber  css show MAP

https://forum.ionicframework.com/t/ionic-2-typescript-google-maps/53006/26
https://github.com/vijtad/Ionic-2-using-sebm-google-map
https://github.com/SebastianM/angular2-google-maps



http://www.joshmorony.com/ionic-2-how-to-use-google-maps-geolocation-video-tutorial/

http://vpt-deeplearner.tech/2016/11/24/ionic-2-an-example-of-googlemap-using-sebm-angularjs-directory/

https://forum.ionicframework.com/t/ts2304-cannot-find-name-google/58725/26

Data Binding Directive

http://www.sqeeex.com/201605/27.html

  • {{value}}  和   [property]='value'
变量绑定在Component中,只要在Component中控制变量值改变,dom中就会更新,它是单向的。

  • (event)
是事件绑定,是单向的,在dom中触发,从而告知Component。

  • [(ng-model)]或者[(ngModel)]
实现双向绑定, angular1中,我们要实现双向绑定是用ng-model="xx",angular2中从用法上来说确实只是多加了两个括号。



ionic2 example

https://github.com/driftyco/ionic-conference-app/tree/typescript

firebase database security rule

best easy know

1、auth != null    -- only auth pass user ( login success user)

2、$uid === auth.uid   -- usually only data owner can read or modify
$userId === auth.uid

==========
1、only admins group can wirte data

a. Database data
add admins -> add uid:true   (uid -> user in admins group)

b. Database rule
add
{
  "rules": {
 
    "admins":{
      ".read"  : "auth != null && root.child('admins').hasChild(auth.uid)",
      ".write" : "auth != null && root.child('admins').hasChild(auth.uid)"
    }
 
  }
}

now uid in admis, can modify admins

If items only admis can add or modify, everyone can read.

{
  "rules": {
 
    "items":{
      ".read"  : "auth != null ",
      ".write" : "auth != null && root.child('admins').hasChild(auth.uid)"
    }
 
  }
}


2、maybe your want user in admins group and some special oooooxxxx

{
  "rules": {
 
    "items":{
      ".read"  : "auth != null ",
      ".write" : "auth != null && root.child('admins').hasChild(auth.uid) && root.child('admins').child(auth.uid).val()==="oooooxxxxxx" "
    }
 
  }
}





http://stackoverflow.com/documentation/firebase/3352/database-rules#t=201701110341085943147

https://gist.github.com/sararob/331760829a9dcb4be3e7   see HerRomero answer

http://stackoverflow.com/questions/21815229/is-there-a-way-to-restrict-registrations-in-firebase/21834842#21834842


ionic2 firebase FCM FCM_TOKEN Device_token Sender_id

https://forum.ionicframework.com/t/push-notifications-with-ionic-2/63851/4
https://github.com/fechanique/cordova-plugin-fcm
=====

https://www.youtube.com/watch?v=7yXtzhqT1uk
https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59#.ff6hz41ot


.sender_id   who is sender or This guy is send message.

.FCM_token (api_key)  it's right to use FMC, who get token, then can send

.Device token  this device (which device)


Where is come from?

.sender_id 、 FCM_token from FCM (firebase)

.Device_token from device



How to get?

.sender_id 、 FCM_token : login firebase console -> settings -> colud messageing

.Device_token : If ionic2, when you use
Push @ionic/cloud-angular push.register().then(t: PushToken)
this time get Push Token. see video 7:54



So how to work?  (If see youtube video, I guess)

.FCM_token:   Who take token, who can send message. FCM get FCM_token, then send message to send_id  under all register.

.sender_id: App or reciver must have this info, when message come from FCM into Phone, then check send_id is correct or not.

.Device_token:
A、Device must send(register) phone's Device_toke to FCM sender_id, then register info(device_token) under send_id. If not register, send_id can't know any devices.

B、Sometime send message to only one device, must use FCM_token + Device_token then only send to one device.

(This Video 9:38 bottom have "Device Options")

(https://github.com/aggarwalankush/push-notification-server
AndroidPush.java  see code have "YOUR_DEVICE_TOKEN" )



https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59#.ff6hz41ot
https://devdactic.com/ionic-push-notifications-guide/


magento install on xampp ubuntu

1、crate virtualbox vm, install ubuntu 16
This step have many tech, just find on google

ps:  start Virtual Box in background
make link, link content is

vboxheadless -startvm  "your vm's name"
check internet is ok~~

2、Use account that when you install ubuntu, create user account. Now example username is "Ubuntu".

Login Ubuntu use "Ubuntu" account.

see   https://www.apachefriends.org/download.html

choese 7.0.13 / PHP 7.0.13

wget https://www.apachefriends.org/xampp-files/7.0.13/xampp-linux-x64-7.0.13-1-installer.run

chmod +x xampp-linux-x64-7.0.13-1-installer.run
install
sudo ./xampp-linux-x64-7.0.13-1-installer.run
then Yes Yes Yes Yes

PS:so now have permit have three :  root 、 daemon、 ubuntu

/opt/lampp and /opt/lampp/*  some directory is root, some is ubuntu or daemon.


2-1、need phpmyadmin, so see this
http://sueboy.blogspot.tw/2016/01/xampp-phpmyadmin-httpd-xamppconf.html

put

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
#Require local
Require all granted
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 192.168.0.0/8 xxx.ooo.xxx.ooo/24
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
xxx.ooo.xxx.ooo/24  can remove, by yourself use.

then check  http://192.168.xxx.xxx/phpmyadmin is ok

PS:Usually I move /opt/lampp/htdocs  all files to allbackup directory that be create by myself.


3、install magento

download Magento-CE-2_1_3_tar_gz , just download from magento website, then upload ubuntu, copy file to /opt/lampp/htdocs

tar zxvf Magento-CE-2_1_3_tar_gz
PS: IF you upload use root, maybe use "sudo tar"

3-1、 check /opt/lampp/etc/httpd.conf

http://www.computernetworkingnotes.com/ubuntu-12-04-tips-and-tricks/how-to-fix-permission-of-htdocs-in-ubuntu.html

User
Group

usually  is "daemon"


3-2、Set ownership and permissions for the shared group

http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-system-perms.html

cd /opt/lampp/htdocs

find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chown -R :daemon
chmod u+x bin/magento
PS: when you "sudo tar", maybe now this step need use "sudo"

4、now see http://192.168.xxx.xxx  , start install magento......


[轉]使用Docker搭建Web漏洞测试环境

http://www.freebuf.com/sectool/123907.html


http://www.freebuf.com/sectool/104524.html




在这个例子中,我直接在一个临时的容器上运行“remnux/metasploit”,退出的时候会消失(“rm”功能类似)。“-it”让你能够通过shell与容器进行交互。

为了保存容器的相关数据,我使用“-v”参数来将容器目录映射到我主机的目录上。我将使用”~/.msf4”目录来存放Metasploit Framework的配置文件。主机上的“/tmp/msf”目录将会存储其他数据,比如你可能从目标系统获取的数据。

参数“-p”对容器内部的端口进行映射。上面的例子用443端口来接收反弹shell的https连接。

angular2 ionic2 angularfire2 json <-> object

authstat json <-> object

import { Storage } from '@ionic/storage';
import { FirebaseAuthState } from 'angularfire2';


// authstate  object -> json

this._auth.signInWithEmailAndPassword(this.loginForm.value.email, this.loginForm.value.password)
.then((authData: FirebaseAuthState ) => {
  this.storage.set('alluserinfo', JSON.stringify(authData));
});



//json -> authstate  object

this.storage.get('alluserinfo').then((t_value) => {
      let value: FirebaseAuthState;
      value = JSON.parse(t_value);
});

Angular2 View Not Changing After Data Is Updated

[轉]Understanding Zones and Change Detection in Ionic 2 & Angular 2

http://www.joshmorony.com/understanding-zones-and-change-detection-in-ionic-2-angular-2/


Angular2 View Not Changing After Data Is Updated


Finish Use

setTimeout(() => {
     this.msgerror = error.message;
}, 10);

查現在連線load balance (haproxy)連到那台db

mysql -h xxx.xxx.xxx.xxx -u root -pxxxooo -e "set GLBAL server_id=xxxooo "

mysql -h xxx.xxx.xxx.xxx -u root -pxxxooo -e "show variables like 'server_id'"

[轉]比较全面的MySQL优化参考(上下篇)

http://imysql.com/2015/05/24/mysql-optimization-reference-1.shtml

http://imysql.com/2015/05/29/mysql-optimization-reference-2.shtml


[轉]找出MySQL服务器发生SWAP的原因?

http://www.ywnds.com/?p=7488
http://imysql.com/2016/11/30/mysql-faq-find-who-cause-mysql-swap.shtml


free -gt 查看内存、SWAP消耗情况


尤其是参加过 知数堂培训MySQL DBA优化班课程 的同学应该都知道,我们在课上多次强调:遇到这种情况,第一条件反射很直接就是:发生内存泄露(memory leak)了。

一般来说,如果发现内存统计结果中,cached和used 相差特别大的话,基本可确定系统发生内存泄露。相应的处理手法有:
治标的办法:择机重启进程,彻底释放内存归还给OS;
治本的办法:找到代码中导致泄露的代码,修复之(我们这次面对的是mysql代码,还是去官方提交bug吧,哈哈);
治本的办法:升级程序版本,通常新版本会解决旧版本存在的问题,推荐此方案。




物理内存还有不少空闲,但把swap都耗尽了。同样滴,这种案例在我们知数堂的MySQL DBA培训课程里也被多次谈及,绝大多数情况是因为没有关闭NUMA引起的。在运行数据库进程的服务器上,强烈建议关闭NUMA,在之前的分享 比较全面的MySQL优化参考(上篇) 中也有提及。



[轉]Docker:搭建私有仓库(Registry 2.4.1)

http://www.ywnds.com/?p=7411



Docker Hub是一个很好的用于管理公共镜像的地方,我们可以在上面找到想要的镜像(Docker Hub的下载量已经达到数亿次)




Registry作为Docker的核心组件之一负责镜像内容的存储与分发,客户端的docker pull以及push命令都将直接与registry进行交互

[轉]docker volumes 容器数据管理

http://www.ywnds.com/?p=7015



多人都对Volume有一个误解,他们认为Volume是为了持久化。如此想法是因为他们觉得容器不能持久化,所以Volume应该是为了满足这个需求而设计的。其实容器会一直存在,除非你删除它们。这可能来自于容器不是持久的想法,这样确实是不对的。容器是持久的,直到你删除他们



Volume并不是为了持久化。而Volume可以使用以下两种方式创建:

1)在Dockerfile中指定VOLUME /data。

2)执行docker run -v /data命令来指定。

无论哪种方式都是做了同样的事情。它们告诉Docker在主机上创建一个目录(默认情况下是在/var/lib/docker下),然后将其挂载到指定的路径(例子中是:/data)

[轉]MySQL实时性能监控工具doDBA tools

http://www.ywnds.com/?p=7499

mariadb galera cluster

https://mariadb.com/kb/en/mariadb/galera-cluster-status-variables/

http://www.ywnds.com/?p=6084

http://benjr.tw/95536

http://www.99cloud.net/html/2016/jiuzhouyuanchuang_0316/131.html

SHOW GLOBAL STATUS LIKE ’wsrep_%’;
  
(1)SHOW GLOBAL STATUS LIKE ’wsrep_cluster_state_uuid’; 集群中每个节点的值必须一致。

(2)SHOW GLOBAL STATUS LIKE ’wsrep_cluster_size’; 显示集群的规模,此例应该显示”2”。

(3)SHOW GLOBAL STATUS LIKE ’wsrep_cluster_status’; 显示”Primary”为正常。

(4)SHOW GLOBAL STATUS LIKE ’wsrep_ready’; 显示”ON”为正常。

(5) SHOW GLOBAL STATUS LIKE ’wsrep_connected’; 显示”ON”为正常。

(6) SHOW GLOBAL STATUS LIKE ’wsrep_local_state_comment’; 显示” Joined”为正常。

rancher MariaDB galera cluster 破壞


sysbench mariaDB

http://www.actionsky.com/docs/archives/171

http://www.slideshare.net/yejr/my-sql-20131020?ref=http://imysql.com/2013/11/19/mysql-benchmark-testing.shtml
==========
apt-get install sysbench


  • 建table、records

sysbench --debug=on --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-password=oooxxx --mysql-host=10.255.255.215 prepare


  • 測試

sysbench --num-threads=16 --max-requests=100000 --debug=on --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-password=oooxxx --mysql-host=10.255.255.215 run


  • 清掉table、records
sysbench --debug=on --test=oltp --db-driver=mysql --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=root --mysql-password=oooxxx --mysql-host=10.255.255.215 cleanup


https://blog.gslin.org/archives/2015/09/13/5971/%E7%94%A8-sysbench-%E6%B8%AC%E8%A9%A6-mysql-%E6%95%88%E8%83%BD/

http://blog.xuite.net/misgarlic/weblogic/56170203-MySQL+benchmark+tool+-+sysbench

http://hugnew.com/?p=737

==========
http://who0168.blog.51cto.com/253401/556300/



[root@localhost bin]# ./sysbench
测试用例:
sysbench [general-options]... --test=<test-name> [test-options]... command

通用选项:
--num-threads=N 创建测试线程的数目。默认为1.
--max-requests=N 请求的最大数目。默认为10000,0代表不限制。
--max-time=N 最大执行时间,单位是s。默认是0,不限制。
--forced-shutdown=STRING 超过max-time强制中断。默认是off。]
--thread-stack-size=SIZE 每个线程的堆栈大小。默认是32K。
--init-rng=[on|off] 在测试开始时是否初始化随机数发生器。默认是off。
--test=STRING 指定测试项目名称。
--debug=[on|off] 是否显示更多的调试信息。默认是off。
--validate=[on|off] 在可能情况下执行验证检查。默认是off。

测试项目:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test(互斥性能测试)
oltp - OLTP test

指令: prepare(测试前准备工作) run(正式测试) cleanup(测试后删掉测试数据) help version

See 'sysbench --test=<name> help' for a list of options for each test. 查看每个测试项目的更多选项列表。

[root@localhost bin]# ./sysbench --test=fileio help
--file-num=N 创建测试文件的数量。默认是128
--file-block-size=N 测试时文件块的大小。默认是16384(16K)
--file-total-size=SIZE 测试文件的总大小。默认是2G
--file-test-mode=STRING 文件测试模式{seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)}
--file-io-mode=STRING 文件操作模式{sync(同步),async(异步),fastmmap(快速map映射),slowmmap(慢map映射)}。默认是sync
--file-extra-flags=STRING 使用额外的标志来打开文件{sync,dsync,direct} 。默认为空
--file-fsync-freq=N 执行fsync()的频率。(0 – 不使用fsync())。默认是100
--file-fsync-all=[on|off] 每执行完一次写操作就执行一次fsync。默认是off
--file-fsync-end=[on|off] 在测试结束时才执行fsync。默认是on
--file-fsync-mode=STRING 使用哪种方法进行同步{fsync, fdatasync}。默认是fsync
--file-merged-requests=N 如果可以,合并最多的IO请求数(0 – 表示不合并)。默认是0
--file-rw-ratio=N 测试时的读写比例。默认是1.5

[root@localhost bin]# ./sysbench --test=cpu help
--cpu-max-prime=N 最大质数发生器数量。默认是10000

[root@localhost bin]# ./sysbench --test=memory help
--memory-block-size=SIZE 测试时内存块大小。默认是1K
--memory-total-size=SIZE 传输数据的总大小。默认是100G
--memory-scope=STRING 内存访问范围{global,local}。默认是global
--memory-hugetlb=[on|off] 从HugeTLB池内存分配。默认是off
--memory-oper=STRING 内存操作类型。{read, write, none} 默认是write
--memory-access-mode=STRING存储器存取方式{seq,rnd} 默认是seq

[root@localhost bin]# ./sysbench --test=threads help
--thread-yields=N 每个请求产生多少个线程。默认是1000
--thread-locks=N 每个线程的锁的数量。默认是8

[root@localhost bin]# ./sysbench --test=mutex help
--mutex-num=N 数组互斥的总大小。默认是4096
--mutex-locks=N 每个线程互斥锁的数量。默认是50000
--mutex-loops=N 内部互斥锁的空循环数量。默认是10000

[root@localhost bin]# ./sysbench --test=oltp help
oltp options:
--oltp-test-mode=STRING 执行模式{simple,complex(advanced transactional),nontrx(non-transactional),sp}。默认是complex
--oltp-reconnect-mode=STRING 重新连接模式{session(不使用重新连接。每个线程断开只在测试结束),transaction(在每次事务结束后重新连接),query(在每个SQL语句执行完重新连接),random(对于每个事务随机选择以上重新连接模式)}。默认是session
--oltp-sp-name=STRING 存储过程的名称。默认为空
--oltp-read-only=[on|off] 只读模式。Update,delete,insert语句不可执行。默认是off
--oltp-skip-trx=[on|off] 省略begin/commit语句。默认是off
--oltp-range-size=N 查询范围。默认是100
--oltp-point-selects=N number of point selects [10]
--oltp-simple-ranges=N number of simple ranges [1]
--oltp-sum-ranges=N number of sum ranges [1]
--oltp-order-ranges=N number of ordered ranges [1]
--oltp-distinct-ranges=N number of distinct ranges [1]
--oltp-index-updates=N number of index update [1]
--oltp-non-index-updates=N number of non-index updates [1]
--oltp-nontrx-mode=STRING 查询类型对于非事务执行模式{select, update_key, update_nokey, insert, delete} [select]
--oltp-auto-inc=[on|off] AUTO_INCREMENT是否开启。默认是on
--oltp-connect-delay=N 在多少微秒后连接数据库。默认是10000
--oltp-user-delay-min=N 每个请求最短等待时间。单位是ms。默认是0
--oltp-user-delay-max=N 每个请求最长等待时间。单位是ms。默认是0
--oltp-table-name=STRING 测试时使用到的表名。默认是sbtest
--oltp-table-size=N 测试表的记录数。默认是10000
--oltp-dist-type=STRING 分布的随机数{uniform(均匀分布),Gaussian(高斯分布),special(空间分布)}。默认是special
--oltp-dist-iter=N 产生数的迭代次数。默认是12
--oltp-dist-pct=N 值的百分比被视为'special' (for special distribution)。默认是1
--oltp-dist-res=N ‘special’的百分比值。默认是75

General database options:
--db-driver=STRING 指定数据库驱动程序('help' to get list of available drivers)
--db-ps-mode=STRING编制报表使用模式{auto, disable} [auto]

Compiled-in database drivers:
mysql - MySQL driver

mysql options:
--mysql-host=[LIST,...] MySQL server host [localhost]
--mysql-port=N MySQL server port [3306]
--mysql-socket=STRING MySQL socket
--mysql-user=STRING MySQL user [sbtest]
--mysql-password=STRING MySQL password []
--mysql-db=STRING MySQL database name [sbtest]
--mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb]
--mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto]
--mysql-ssl=[on|off] use SSL connections, if available in the client library [off]
--myisam-max-rows=N max-rows parameter for MyISAM tables [1000000]
--mysql-create-options=STRING additional options passed to CREATE TABLE []



  • 测试cpu

./sysbench --test=cpu --cpu-max-prime=20000 run

  • 测试线程

./sysbench --num-threads=64 --test=threads --thread-yields=100 --thread-locks=2 run

  • 测试mutex

./sysbench --num-threads=1500 --max-requests=2000 --test=mutex --mutex-num=10240 --mutex-locks=100000 --mutex-loops=15000 run

  • 测试fileio
./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw prepare

./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw run

./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw cleanup


  • 测试OLTP
./sysbench --test=oltp --mysql-table-engine=innodb --mysql-port=3307 --mysql-db=test --oltp-table-size=10000000 --mysql-socket=/tmp/mysql-5.5.8.sock prepare


./sysbench --num-threads=100 --max-requests=100000 --test=oltp --oltp-table-size=1000000 --mysql-port=3307 --mysql-db=test --mysql-socket=/tmp/mysql-5.5.8.sock run


./sysbench --test=oltp --mysql-table-engine=innodb --mysql-port=3307 --mysql-db=test --oltp-table-size=10000000 --mysql-socket=/tmp/mysql-5.5.8.sock cleanup

[轉]docker 與本機端資料戶傳的方法

// 從外面送一個 my_sound.mp3 檔案進去 docker 環境裡面的 /my_sound.mp3



// 使用 ebuildy/echoprint 這個 docker image 裡面的 echoprint-codegen 程式去跑它

docker run -v my_sound.mp3:/my_sound.mp3 ebuildy/echoprint echoprint-codegen /my_sound.mp3



// 把資料從 container 當中拿出來    ebca1bdd8bfc -> container id

docker cp ebca1bdd8bfc:/opt/echoprint.tar .



// 把資料test.c從本機端丟進 docker container 中

docker cp test.c ebca1bdd8bfc:/





// 列出正在run的 docker image 環境

docker ps



// 列出我有電腦上載下來的 docker images

docker images

[轉]Creating an Asynchronous Login Screen in Ionic 2

https://www.youtube.com/watch?v=5WK9R1y-eKg

================
http://eriyu-blog.logdown.com/posts/773548-study-of-ng2-polyfill

主要是提供ES7提出的Observables特性,

Observables提供了非同步資料fetch時的另一種做法。

我們跟伺服器端抓取完資料,要做後續的動作時,

最早的寫法是用callback,

後來改良的寫法是使用Promise減少callback hell的發生。

Promise已經很好用了,但是它還是有些缺點。

它無法做到發送request後,可以中止或是重送的功能。

它在宣告使用Promise時,就已經被執行了。

而Observables解決了Promise的這些問題,

它可以中止及重送request。

Observables在創建時不會被執行,而是實際呼叫時才被執行。

另外Observables又提供了值組的操作,像是merge、sum、map等功能。

還有Observables就如同它字面的意思,他實作觀察者模式,當資料變更時會發出通知給它的訂閱者。

官方的Angular2教學文件在非同步資料抓取,是直上ES7的規格,提供Observables的寫法,但你也可以依據你的專案需求改成Promise。

一般的專案,也許可以用Promise就能滿足了,但是如果你的專案功能是需要比較互動、即時性的時候,用上Observables就不用費太多功夫做資料的watch。

[轉]observables-in-ionic2

https://www.joshmorony.com/building-mobile-apps-with-ionic-2/observables-in-ionic2.html


this.http.get(url).subscribe(

    (data) => {
        console.log(data);
    },

    (err) => {
        console.log(err);
    },

    () => {
        console.log("completed");
    }
);

In the code above the first event handler handles the onNext response, which basically means "when we detect the next bit of data emitted from the stream, do this". The second handler handles the onError response, which as you might have guessed will be triggered when an error occurs. The final handler handles the onCompleted event, which will trigger once the Observable has returned all of its data.



etc.... just see webpage

ranche + kubernetes

https://read01.com/PL50mL.html

GALERA CLUSTER


  • GALERA CLUSTER FOR RANCHER


http://www.dockerinfo.net/1771.html

https://octoperf.com/blog/2016/11/17/rancher-galera-cluster/




  • Running a Galera Cluster in Kubernetes


https://www.percona.com/live/data-performance-conference-2016/sessions/running-galera-cluster-kubernetes

http://severalnines.com/blog/installing-kubernetes-cluster-minions-centos7-manage-pods-services




  • Architecture of deployment on Azure


http://withblue.ink/2016/03/09/galera-cluster-mariadb-coreos-and-docker-part-1.html



ionic2 angularfire example better than google example..............

https://github.com/rodrigoreal/ionic2-angularfire-login




==========
https://github.com/angular/angularfire2/issues/560
https://blog.khophi.co/angularfire2-authentication/

https://github.com/angular/angularfire2/issues/568

https://github.com/angular/angularfire2/issues/566

AngularFire ionic2 auth

Very Important !!

use subscribe

constructor(public af: AngularFire) {
    af.auth.subscribe((authstate) => {
        console.log(authstate);
        authstate == null ? logout() : login(authstate.auth.displayName);
    });
  }

And  Think change to Callback mode .............


==========
First :
   everyone use af.auth.getauth() , then check,  have value is login, null is not login.

But it's mistack. Reload page, Change page  AngularFire miss...... af.auth be free.
Only login page can get af.auth

Second:
  af.auth.subscribe ( ....... )   When auth check finish, run subscribe ( ..... )
This is real get auth. But Think login different First way........

ionic run android gives Property … does not exist on type ‘{ [key: string]: AbstractControl; }’

ionic run android gives Property … does not exist on type ‘{ [key: string]: AbstractControl; }’


https://forum.ionicframework.com/t/property-does-not-exist-on-type-key-string-abstractcontrol/65783

http://stackoverflow.com/questions/39881367/property-does-not-exist-on-type-key-string-abstractcontrol/39886710

I Test Finish:

1、In ts files, still use   loginForm: FormGroup;

2、loginForm.controls.password.valid   -> loginForm.get('password').valid

mysql heidisql

http://www.heidisql.com/

FreeNAS replication dataset set a read-only

https://forums.freenas.org/index.php?threads/replication-dataset-set-a-read-only.46889/

https://forums.freenas.org/index.php?threads/replication-target-datasets-mounted-ro-in-freenas-9-3-stable-201602020212-and-newer.41246/

https://forums.freenas.org/index.php?threads/zfs-replication-and-making-the-destination-read-write.10551/


https://bugs.freenas.org/issues/15011


zfs list -o name,mountpoint,mounted,readonly volrep/common


zfs set readonly=off tank/root

redis

http://www.runoob.com/redis/redis-tutorial.html

mariadb ubuntu 16.4


官方
https://mariadb.com/kb/en/mariadb/installing-mariadb-deb-files/


  • New Key
  • Add MariaDB to your sources.list 

sudo apt-get install software-properties-common 
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'


sudo apt-get update
sudo apt-get install mariadb-server


.begin install maybe have question about other mariadb toolkit install
If Y -> have one question for root password
If N -> use  mysql_secure_installtion  for secure


Finish install mariadb.

modify my.cnf    /etc/mysql  ( find / -name my.cnf )

[mysqld]
1、port  maybe change  3306 -> 6033
2、listen maybe 127.0.0.1 -> 0.0.0.0


login mysql

1、root login anywhere %, full rights

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'put password' with grant option;


2、create other account  login anywhere %, full rights

GRANT ALL PRIVILEGES ON *.* TO 'otheraccount'@'%' IDENTIFIED BY 'put password' with grant option;



3、remove  Revoke  (權限)

REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'root'@'%';

4、Remove/Delete the user

DROP USER 'root'@'%';


5、show user and grant 顯示
SELECT User,Host FROM mysql.user;

SHOW GRANTS FOR 'root'@'localhost';
SHOW GRANTS FOR 'root'@'%';

http://idroot.net/linux/install-mariadb-ubuntu-16-04/



T2 instance CPU Credit Usage & Balance

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-instances.html


CPUCreditUsage

(Only valid for T2 instances) The number of CPU credits consumed during the specified period.

consumed 消耗


CPUCreditBalance

(Only valid for T2 instances) The number of CPU credits that an instance has accumulated.

accumulated 累積

電影票 打折 180

101文具天堂
https://goo.gl/vv6yEC


墊腳石



http://webptt.com/m.aspx?n=bbs/TaichungBun/M.1436676457.A.4B1.html

2F:推 jrico: 如果你有習慣在親親看,就千萬不要買優待票,辦張會員卡,一張 07/12 13:34
3F:→ jrico: 會員卡,一張票雖190但有含(爆米花汽水或去換哈拉麵包餐盒) 07/12 13:35
4F:→ jrico: 買三送一(一張票有兩點,及六點,一到四可以免費看一場) 07/12 13:36
5F:→ jrico: 所以平均下來一張票才143(又有東西可以吃) 07/12 13:36

[轉]流媒体直播——资料整理、你想要了解的都在这。

https://www.hongweipeng.com/index.php/archives/835/


http://www.cnblogs.com/lingyunhu/p/rtc28.html

https://jitsi.org/Projects/JitsiVideobridge

https://www.youtube.com/watch?v=OT6kwzsQeVc&feature=youtu.be

https://my.oschina.net/langhuihui/blog/598338
https://my.oschina.net/langhuihui/blog/602265
https://my.oschina.net/langhuihui/blog/612144

ionic2 add new components

http://ionicframework.com/docs/v2/components/#overview

1、src\app\app.module.ts  import

  • import 
  • declarations
  • entryComponents
2、src\app\app.components.ts  import 
  • import
  • this.pages
3、If  .ts .html .scss files in src\pages\

  • .ts 
  • @component   templateUrl
  • export class
  • .html
  • ion-navbar     remeber  button  & menu

usually change this step and file, then you can test Components.

rtmp to html5 websocket webrtc


http://flashphoner.com/broadcasting-of-a-streaming-video-from-a-professional-video-capturing-device-live-encoder-via-the-rtmp-protocol/

這套大概是目前可以把rtmp轉成websocket和webrtc


https://wcs5-eu.flashphoner.com/dashboard.xhtml
這是他的deom,Streamer就是把攝像頭和聲音轉成html5 (websocket、webRTC)能接收的


有下載 web call server 5.0 但要序號,問官方,說沒試用

============
另一個可能
Monaserver  
http://www.monaserver.ovh/

freenas proxmox esxi vm

https://www.facebook.com/groups/nas.tw/permalink/10154653693713245/


走iscsi
沒 ups  -> no cache


os disk 使用 HDD pool
database disk 使用 HDD pool + NVMe Cache (zil and cache)
file disk 使用 HDD pool + cache

snmp OBSERVIUM Miunin

http://www.observium.org/
http://www.observium.org/docs/add_device/


Miunin
http://munin-monitoring.org/

http://joe-dev.blogspot.tw/2012/08/munin.html
http://waste.mandragor.org/munin_tutorial/munin.html#getting_started

[轉]Video live streaming in html5

https://github.com/sbidolach/video-live-streaming

[轉]關於VMware版本選擇

http://vmware.mosquito.tw/phpbb3/viewtopic.php?f=13&t=25


以性價比來說
essentials plus絕對是最划算的
它以套裝的方式將vCenter搭售進來
在預算有限的情形下,它的確是不錯選擇
但它限制了ESXi的擴充性
再加上沒有好用的Storage vMotion功能
總是讓人覺得有所缺憾
轉而往上看進階一點的版本


Standard版來看
Server vMotion、Storage vMotion、ESXi HA都有支援
看起來已經很適合一般企業使用
但仔細看看,它少了DRS的功能(Distributed Resource Scheduler)
或許一開始不會覺得DRS並不太需要
可是當您要管理的虛擬機超過50多台
就會發現資源管理變的很麻煩
需要每一台去調配,無法用share的方式去管理
vMware也無法自動依每台ESXi host使用率去自動協助vMotion來達到Loading balance
就會開始後悔怎麼沒有買到Enterprise的等級


Enterprise版看來已接近完美
有vMotion,Storage vMotion, ESXi HA
又有DRS功能讓你可以方便的管理整體resource
又能讓VMware自動啟動vMotion去平衡每台ESXi的資源使用
但你又會發現竟然要買到Enterprise Plus版本,才能擁有VDS(分散式虛擬交換器Virtual Distributed Switch)
沒有VDS,每一台ESXi都要去設定自己的VSS(Virtual Standard Switch)
只要有需求更改一個VSS上的設定,就要到每一台ESXi上的VSS去更改
而且居然只有VDS才支援LACP的NIC Teaming方式


在價格比方便,standard : Enterprise : Enterprise Plus 大概正好是 1 : 2 : 3
真是太讓人生氣了....
明明Standard版本已經很符合功能了
但想要再多那一點好用的部份,卻要用3倍的成本才能取得
如果預算沒有問題
真的還是建議直接採購Enterprise plus版本

[轉]io-comparison-proxmox-kvm-raw-qcow2

http://sclabs.blogspot.tw/2016/07/io-comparison-proxmox-kvm-raw-qcow2_23.html

convert lvm to raw

http://pve.proxmox.com/wiki/Storage_Migration

==========
qemu-img convert -O qcow2 /dev/VMStor1/vm-100-disk-1 /mnt/VMStor2/images/100/vm-100-disk-1.qcow2

convert raw to lvm

qemu-img convert -p -f vmdk "IE11 - Win7-disk1.vmdk" -O raw /dev/mapper/pve-vm--101--disk-1

==========

qemu-img convert -p -f vmdk "IE11 - Win7-disk1.vmdk" -O raw "IE11 - Win7-disk1.raw"

dd if="IE11 - Win7-disk1.raw" bs=1M|pv| dd of=/dev/mapper/pve-vm--101--disk--1





https://forum.proxmox.com/threads/dd-raw-drives-to-lvm-is-slow-is-there-a-better-way.29785/

vCenter 授權

vCenter Server 的授權版本不支援VMware vSphere 5 Enterprise Plus

vSphere 分為六種授權 Essentials、Essentials Plus、Standard、Advanced、Enterprise、Enterprise Plus

Essentials、Essentials Plus 適合使用於中小型企業

Standard、Advanced、Enterprise、Enterprise Plus 適合使用於中大型企業

Essentials、Essentials Plus: 授權費用中 包含 vCenter Server 軟體費用,此版本的 vCenter Server 最多只能管理 3 台 ESX 伺服器,也就是 3 台實體伺服器。


Standard、Advanced、Enterprise、Enterprise Plus: 授權費用中 不包含 vCenter Server 軟體費用,並須另購授權。



vCenter: 為 ESX / VM 管理平台,若 ESX 主機環境中沒有 vCenter 則一些進階功能例如 VMotion、HA...等都無法進行實作
vCenter for Essentials: 與 vCenter Foundation 此版本的 vCenter 僅搭配 Essentials 及 Essentials Plus Kit。
vCenter Foundation: 限制只能管理 3 台 ESX 伺服器,也就是 3 台實體伺服器。
vCenter Standard: 沒有限制管理 ESX 伺服器台數,也就是不限制實體伺服器數量。

vCenter 登入不要打網域

正常登入要打網域

vsphere.local/xxxxxxxxx


如果把Administrators加入 vCenter 該台機器的 系統管理員
然後把帳號加到Adimistrators群組內,這樣就能登入


http://blog.xuite.net/tolarku/blog/250007676-VMWare+vcenter+SSO+%E6%96%B0%E5%A2%9E%E4%BD%BF%E7%94%A8%E8%80%85+-+%E6%8E%88%E8%88%87%E7%AE%A1%E7%90%86%E6%AC%8A%E9%99%90


[轉]cloudflare加速最佳化設置

https://hzsh.xyz/173/cloudflare%E5%8A%A0%E9%80%9F%E6%9C%80%E4%BD%B3%E5%8C%96%E8%A8%AD%E7%BD%AE#comment-207

[轉]vestacp

https://hzsh.xyz/679/vestacp%E5%AE%89%E8%A3%9D-%E5%85%8D%E8%B2%BBvps%E6%8E%A7%E5%88%B6%E9%9D%A2%E6%9D%BF%E9%85%8D%E7%BD%AE%E6%95%99%E5%AD%B8

Remove Cluster configuration

http://pve.proxmox.com/wiki/Proxmox_Cluster_File_System_(pmxcfs)

stop the cluster file system in /etc/pve/
# systemctl stop pve-cluster


start it again but forcing local mode
# pmxcfs -l


remove the cluster configuration
# rm /etc/pve/cluster.conf
# rm /etc/cluster/cluster.conf
# rm /var/lib/pve-cluster/corosync.authkey


stop the cluster file system again
# systemctl stop pve-cluster


restart PVE services (or reboot)
# systemctl start pve-cluster
# systemctl restart pvedaemon
# systemctl restart pveproxy
# systemctl restart pvestatd


=======移除node==============
經PVE03 執行pvecm delnode pve07
刪除 已重灌的pve07 節點,corosync.conf 內的node 資料已刪除
但gui上仍出現pve07 的資料
需手動進pve03 的shell,進入/etc/pve/nodes,rm -rf pve07
手動刪除pve07 的資料夾,再重整網頁gui,pve07即消失

proxmox cluster failed

pvecm expected 1

暫時把集叢的期待數量從2降低為1

service pve-cluster restart


==========
本機運作
systemctl stop pve-cluster
pmxcfs -l


==========

systemctl restart corosync.service
systemctl restart pve-cluster.service
systemctl restart pvedaemon.service
systemctl restart pveproxy.service



https://pve.proxmox.com/wiki/Separate_Cluster_Network

proxmox lvm

pvs
vgs
lvs

pvdisplay
vgdisplay
lvdisplay

lvdisplay  可以看到目前all locate % size

qnap lacp layer 2 layer 2+3

https://www.qnap.com/zh-tw/tutorial/con_show.php?op=showone&cid=216



目前預設的Layer 2(MAC) 相容性最高, 但僅能使用MAC來進行負載平衡。我們建議您用Layer 2+3 (MAC+IP)來達到更好的效果,但此功能必須交換器同時也有支援Layer 2+3 (MAC+IP)才能使用。 因此請先確認您的交換器可以支援Layer 2+3 (MAC+IP)。


就單個用戶端而言,即使使用Port Trunking技術,NAS之傳輸速度仍會維持為單一埠之速度。例如:若您使用的是兩個1Gb的網路埠,則使用聚合技術之後,雖然網路總頻寬已增至2Gb,但網路速度仍會維持在1Gb/s。

vlan cisco

vlan — IP

Port (interface) - vlan (access)

Port (interface) - 單/多vlan (trunk)  allowed (add | all | except)

Port (interface) - no switch port (set ip address)



ip routing  讓vlan互通

ACL 讓vlan互不通


http://blog.yam.com/gavint/article/31578943

http://www.hkitblog.com/?p=19103

use zfs directly to send snapshots

https://forum.proxmox.com/threads/pve-zsync-vs-others-like-znapsend-or-sanoid.27663/#post-139274

FreeBSD ZFS Backed ESXi Storage Over NFS

FreeNAS NFS  dataset set  sync=disabled

zfs set sync=disabled tank/dataset 

Need to remeber have data risk.


https://www.ateamsystems.com/tech-blog/solved-performance-issues-with-freebsd-zfs-backed-esxi-storage-over-nfs/

http://christopher-technicalmusings.blogspot.tw/2011/06/speeding-up-freebsds-nfs-on-zfs-for-esx.html

vmware esxi nfs Settings

https://www.vmguru.com/2015/12/best-practices-running-vmware-with-nfs/

hugo chang ip and bind all

hugo server  --theme=hugo_theme_robust --baseURL 192.168.xxx.xxx:1313 --bind "0.0.0.0"


baseURL 192.168.xxx.xxx   you server ip

bind  for all  default only localhost.......

streaming mpeg-dash GPAC live streaming html5 browsers

Live Streaming to HTML5 Browsers

https://github.com/sparks/rter/blob/master/docs/streaming.md


Now need webSocket, webRTC or mpeg-dash
http://flashphoner.com/broadcasting-of-a-webrtc-stream-to-ios-safari-and-other-browsers-with-low-latency/


GPAC
https://gpac.wp.mines-telecom.fr/
https://gpac.wp.mines-telecom.fr/dashcast/


mpeg-dash

dash.js
https://github.com/Dash-Industry-Forum/dash.js/wiki

http://dashif.org/software/


DASH Low Latency Web Server

https://github.com/gpac/node-gpac-dash


MPEG-DASH browser support and device compatibility

https://bitmovin.com/mpeg-dash-browser-support-device-compatibility/




http://www.mem.com.tw/article_content.asp?sn=1207190001

https://imququ.com/post/html5-live-player-1.html
https://imququ.com/post/html5-live-player-2.html
https://imququ.com/post/html5-live-player-3.html

[轉]How to Fix PIN Errors After Restoring from TWRP Android Backups

http://www.howtogeek.com/240657/how-to-fix-pin-errors-after-restoring-from-twrp-android-backups/

[轉]台灣為什麼變弱了,二十年來台灣倒底“少做”了什麼?



http://www.mobile01.com/topicdetail.php?f=291&t=4913584&p=8





8KK





2016-09-07 09:07 #4






內鬥跟扯後腿以及官商勾結




好的貿易協定卻被另一個說這是賣台說不能簽

單單是關稅的影響就讓台灣生產的售價比其他國家貴10~25%

尤其是韓國,韓國產品品質不差,但價格卻能比台灣賣更便宜




於是消費者優先考量就是韓國產品




台灣是海島國家,必須依靠外銷才能撐起經濟

但是因為貿易協定一直都被人扯後腿

被有心人士找無知的學生來抗議




喊口號不會讓你競爭力提高

喊口號不會讓台灣經濟起飛

喊口號不會讓飯從天上掉下來




結果導致台灣的外銷競爭力一天不如一天




而台灣廠商為了生存

就只能不斷把產線給外移




產線一旦外移就會使失業率提高

會讓越來越多人沒工作

失業率提高

整體競爭力就會下降




如此不斷惡性循環下

台灣經濟就不斷衰退了




在台灣選舉是需要龐大的資金

於是政客就會找財團支援

當政客當選後就會被財團給控制




就算沒有控制也會互相互惠

反正政府的錢不是我的錢

只要放鬆一下

就可以讓政府大開方便之門

然後讓財團有利可圖

政客也當然能從中獲利




慢慢國家的錢就因為各種浮濫及金額灌水的標案而被掏空

國家沒錢就用國家的名義借錢

然後再把稅金拿去填補坑洞




在這段過程中

政客 財團 銀行都能從中獲利




唯一的受害者就是民眾

但是因為是溫水煮青蛙

民眾不會感覺痛




而經濟會慢慢反應出來

因為錢沒有花在刀口上

導致經濟越來越衰退














alffu





2016-09-07 09:35 #7






一人得道(當選總統),可指定幾百個專案的官員,例如水利局-局長、環保局....




這些官員以往都是局內優秀人員上來,現在都是誰當選,就派誰的親戚(的鄰居的同學)




任期又短,亂指揮,治水工程可以改來改去嗎?




佔二年,領了18%,又換一個




換來換去,政策一直【改來改】




兩黨都一樣










水云






2016-09-07 09:43 #9






沒有少做什麼

台灣沒有變弱,只是別人變強




同樣的




日本沒有失落 20 年,只是被 台灣 找到 10 年、被 韓國 找到 10 年








8KK








2016-09-07 09:48 #11






貿易協定乃是雙方彼此開放條件來談

你不開放條件來互惠,對方哪有可能讓你零關稅




你想得到零關稅

當然要有所付出

但卻被有心人士利用開放條件的理由說是賣台

於是阻擋簽貿易協定




每一次的貿易協定我們沒簽到的話

台灣產品就會比其他國家更貴一次




我友好幾個客戶就在痛罵

因為台灣沒有簽到貿易協定

導致台灣產品被徵收10%以上的稅金

其他國家乃是零稅金




客戶想衝刺海外市場

但是成本硬是比其他國家還高10%以上

想打出品牌也要先能站穩基礎才行

但想先站穩基礎

成本硬是比別人高




這是一場還沒開打就已經輸掉的戰爭了










8KK





2016-09-07 10:11 #16






這也是為何台灣低中高階各大產業不斷外移的原因




以前台灣是密集勞力產業外移

因為大陸跟東南亞工資低




密集勞力產業是需要大量廉價的勞工來從事簡單的生產

所以密集勞業產業外移對台灣影響並不大




當時中高階產業並沒有外移

因為中高階產業不需要廉價的密集勞力




而中高階產業乃是高獲利產業

所以密集勞力的低階產業外移對台灣經濟影響不大




但這幾年許多國家紛紛一起簽貿易協定

這時台灣中高階產業發現

我們的產品越來越無法跟其他國家對打




每個國家都有中高技術產業

但其他國家的中高技術產業成本越來越低

導致我們中高階產業產品越來越難賣出去




其他國家的產品由於低稅金

所以可以不斷賺取外匯

然後再從中撥錢出來研發新產品

慢慢差距就越拉越大了




原本產品獲利可以達到40%以上

但產品獲利一年比一年少

從40%一路降到10%以下,最後變成毛三到四

公司獲利大減當然員工的薪資跟福利就會大減

連帶的國內經濟也受到影響(敢花錢的人越來越少)




中高階產業為了能提高競爭力

只好開始把公司重心移到新加坡&香港&大陸..等國家

並且把核心技術人員外派




而新加坡政府為了能留下這些產業

大開方便之門

導致台灣很多高技術以及高端人才的產業都紛紛外移到新加坡

這也讓新加坡經濟突飛猛進




原本台灣產業只有低階產業外移

現在連中高階產業也外移了




若是台灣還是民粹治國的話

那台灣到時就會淪落跟菲律賓一樣的下場




在以前菲律賓可是經濟強國

但由於政府腐敗貪污內鬥

於是變成落後國家










8KK





2016-09-07 10:43 #22






台灣並沒有輕財團

台灣比韓國好的是財團影響力沒有那麼大




但台灣對於財團的態度是能放水就放水




看看這幾年的食安新聞

試問那些大廠有被強力制裁嗎?




財團被罰款億元卻不繳

試問政府有強力追討嗎?







可以放水就放水

若使引起民怨的話就先口頭上逞罰

等風聲過後就當作沒這回事










dongmark





2016-09-07 11:02 #31






學習美國民主社會




會出現的問題




就是少數資本控制多數民眾




這就是逐利的狼群社會




600萬猶太人控制3億美國人




帶著美國金錢社會向前走




制度同樣的事情在台灣是一樣一樣的







另外一個美式民主




是大量消耗社會資源的制度




每次選舉的錢財




實質上很多是打水漂




有利有弊




看台灣經濟以後是否玩得起美式民主










abond yeh





2016-09-07 11:18 #36






好久沒看到01上面有這麼理性的討論串,感動!




小弟長期在現在正夯的東南亞國家工作




從早期當地廠家(華裔居多)清一色都是購買台灣的機器,一直到現在其他國家取代,除了價格成本因素外(就是上面討論到的貿易協定),還有情感及國家印象的因素。




1.雖然很多人不喜歡中國,但是大國崛起是趨勢,在東南亞哪一國不是仰仗他的鼻息?我國和對岸的貿易協定不只是兩國事務,也會影響其他國家的態度,而當然我國和其他國家簽貿易協定不需要對岸同意,但國際現實是把台灣視為對岸的附屬,故要跟其他國簽貿易協定,至少我國和對岸的要先搞定!當初貿協和表決過程被污名化為避免爭執,那就不說了。




2.記得之前有人要刪減僑委會預算,認為為何要拿錢去發展除了台僑以外的僑務?老一輩的海外華人一直認為中華民國才是正宗,就算他們從來不是中華民國國民,所以在情感上會喜歡跟台灣做生意、來台灣玩。而現在哪?僑務工作沒有經費、對岸大肆挖牆腳、年輕一輩華人沒有認同感,也連帶影響跟台灣的經濟往來。

像現在韓劇風行、日本外資企業為當地第一外資,當地年輕人選擇旅遊會去日本、韓國,還是台灣?




3.台灣人骨子裡還是歧視外人,對東南亞國家的印象還停留在二十年前,泰國滿街都是人妖?大家都騎大象當交通工具?當地手機很稀有?我們的島國性格太重,不國際化一點、視野不廣一點只會故步自封了~




4.南向政策喊得震天價響的,說穿了只是不要企業到對岸去,實際的作為呢?有提供跟台灣本土企業一樣的貸款利率給台商嗎?有集合政府的力量來爭取台商權益嗎?我只看到為了交差所簽無任何實際效力的備忘錄,以及『傾聽』台商聲音的不足一小時的座談會。




5.污名化的企業家~社會氛圍很奇怪,好像有錢該死、老闆都是無良的?這樣跟共產黨鬥垮有產階級有何兩樣?我們自傲的民主呢?自由的資本主義社會呢?




一不小心說了那麼多,哈哈哈,果然是老了










dongmark





2016-09-07 11:32 #39






全球各地分佈的華人接近8000萬人口




都是當地經濟的絕對有影響力的一支







過去之所以和台灣經貿聯繫緊密




完全是因為台灣還自居中國正統,在全球華人中擁有絕對的地位







現在台灣人以生為中國人為恥




思維不光在台灣島內混亂




還造成了台灣在全球各地華人社團影響力的直線下落










h348213





2016-09-07 11:32 #41






僅分享




jim567

加入好友 加入黑名單

2016-09-07 11:29

就小弟的觀察,從15年前看到現在...我一直都在關心台灣的發展。

小弟我76年生,從國一開始注意東協10國、金磚四國、大陸、韓國、新加坡的轉變




對我來說,一路上只看到失望再失望......

幾個原因分享一下,

1. 台灣產業轉型,過去60年代末前台灣培養了很想專業人出國深造,當然帶回台灣未來發展的基礎,在加上政府政策明確扶持有不錯的成績。

但是轉眼到近20年,沒有再看到有企業企圖轉行或新事業發展,中小企業開始守成然後沒落,大型企業由於發展新事業沒有在大膽、前瞻的執行導致產品優勢漸漸不在、也導致台灣經濟停滯!




2. 教育政策轉變,台灣過去由於陳前總統廣設大學為了成就一縣一大學,廢除專科制度,導致社會無法評鑑學生個別優勢,造成既不重專業、也不重視學歷的社會現況。產業與學界也嚴重脫節,除了醫科需要進行實習外其餘的學科都完全沒有跟業界連結,沒看過工廠、產業現況、最新技術、國際關係這些通通脫節。




3, 台灣社會人民還是太過短視,由於台灣沒有任何一家國際媒體在日間播放、唯一的英文新聞卻在晚上11點。反觀中國有將一線國際媒體翻譯成中文讓不懂英文的觀眾接受到第一線的資訊,日本、韓國全都有也同樣的做法。

台灣還搞不清楚世界在玩什麼把戲,我們還在關心哪位藝人暗戀、那位立委說了什麼話、哪個名嘴又告了誰這些無關台灣發展的新聞要點!




4. 語言能力停滯,外語推行已經30年以上,而台灣的英語能力卻停滯不前,外面企業卻把自己要求的標準降低造成自我良好的外語錯覺, 這進一步影響國人對外資訊吸收及能力成長的限制,因為大家沒得選,只看得懂中文,無法在進一步了解。




5, 政策轉向,政策不斷在內部打轉,連續三政黨轉移都沒有看到明確持續的國家目標,台灣已經害怕跨出去,未能在過去即時的開放大陸交流、也怕台灣企業流失,而設立許多保護條款。台灣大學生到現在還保有中國是落後國家,洗手間沒有門等等落後印象。




以上小弟的見解、不帶任何政治立場。










lonxyz168





2016-09-07 11:40 #45






呵呵,台灣會衰敗是重政治輕經濟的結果,老是扯甚麼國家認同最討人厭,笨蛋永遠只會被少數政客牽著鼻子走,有錢人為了避稅都可以改國籍當外國人了,只有笨蛋才會信那些每天高喊愛台灣的政客!




愛台灣先把台灣經濟弄好再說,看中外幾千年的歷史下來真正和平發展的時間合計都沒幾百年,以國家、宗教、種族、地域認同為訴求用來鬥爭從史至今沒斷過,殊不知這都是少數政客用來謀求自身利益最好的手段。




希望嘲笑22K的政黨執政了能把22K多提高幾K;希望反對服貿的執政黨能幫台灣多簽幾個協定回來;希望嘲笑633的至少要能做到543。










shizukaman





2016-09-07 11:47 #50






其實樓主的看法都只是結果?

一個國家的演變還是要看長期的,中間一個方向變了,就成了現在的結果

而一個國家不管政府企業都是人民自己組成的

大家都知道

怪政府,怪企業,怪媒體但是為什麼他們會變成這樣

就我個人覺得,真正的根源還是,

人民普遍的素質還沒到那個程度,

素質低落的人民,面對權力的使用越是荒腔走板

人民有了選票就覺得我最大,選上了鄉長立委就迷失濫權

當個公司小主管就不可一世,當了老闆唯利是圖

當了媒體就拿錢辦事,個人意識偏頗報導




就我來說就是,台灣的民主來的太快,人民還沒準備好而已

要推動一個國家這個巨輪,有這麼多聲音

你再怎麼努力,該扯後腿的還是會扯後腿

想想看今天有人拿著幾億元,請大把林志玲等級的美女誘惑,讓你幹危害國家的事,

首先失敗的機率低,即使失敗了你的付出代價也低

請問有這樣好康事情,你會去幹嘛!

「不會」坐在電腦前打著鍵盤的你,一定這樣說

但是,當美女捧著白花花的銀子跟你在HOTEL房間內,脫光了站在你面前

你還會這樣說嗎?




只有相對的集權你才有辦法把,一個國家導向正軌

當聯合國在批評,菲律賓總統杜特蒂上任掃毒造成幾千人的死亡

卻不願提菲律賓多年來,因毒品這個萬罪之源的危害,使得更多守法的人被搶或被殺,

如果一年的陣痛造成菲國毒品相關犯罪分子有一萬人的死亡

能換上今後幾十年,減少因毒品氾濫而解救10萬個平民百姓

是我的話,我也會毫不考慮的選擇後者,如果不集權能做得到嗎?




但是人的感受都只是現在進行式,

當你說機車退出騎樓,還是大學生的你很幹,因為你沒地方停了,反對政府這個決定

所以選舉你投了反對票,過了幾年你出社會了,當個上班族,或帶著妻兒

走在你曾經停機車的騎樓,你的感受呢,是不是會覺得能很舒適的走在空曠騎樓內心情舒暢嗎?

但是你會去反省當初你因為很幹而投給反對陣營的自己嗎?我想不會吧!




很多人在為台灣的民主感的自豪,

每個人都認為他所支持的才是對國家最好的

當所有的政府決策方針,都需要聽一個平民百姓意見時

基本上已經沒有專業了,會吵的小孩有糖吃,所以當你順應了10%的需求,可能會損害到20%的人的需求

而70%的人事不關己,他可以因為意識形態去支持10%的人

所以你就看到這個國家你要推動甚麼前進,卻怎麼努力確也完全動不了










h348213





2016-09-07 11:55 #54






南進政策只有曇花一現罷了...

1. 台灣對東南亞並不熟悉,語系也不熟悉,英文老實說少數人只能算堪用。

2. 我們對南進只去要人力、工廠而不是要他們的市場,這樣的做法不就跟10年前去大陸一樣嗎?

3. 大者恆大趨勢,中國、美國、日本還是是世界上三大經濟個體,歐盟這麼多國家,初創歐盟時台灣怎麼不進去呢?

4. 東協內還是已經是同等的泰國、印尼、越南、印度幾國國家、他們已具備語言、人文&經濟保護優勢,回頭看看台灣呢?






夏米克





2016-09-07 12:06 #65






原因很簡單




就是『中國崛起』就只有這個理由而已




不用怪罪到太陽花也不用牽扯到什麼關稅服貿,

年輕人沒國際觀你老人也沒有,不用五十步笑百步。

今天就算全部都通過,陸客照來,台灣依舊向下沉淪,

太陽花也是馬執政後期的事情了,那時股票還逆勢上漲,

顯示我國政府機關早就空轉許久了。




為什麼我會說『中國崛起』是主要理由呢?




就說香港吧,

年輕人不夠國際觀嗎?外語不好嗎?貿易協議也沒被檔阿!(好啦有擋高鐵)

但香港沉淪的速度可是台灣的好幾倍快。




中國崛起對於世界各國可能是掏金好地方,

但至少對於香港和台灣可不是如此。




為什麼?

因為政治關係,中國要邊緣化這兩個地方實在是易如反掌,

而且這還是行之有年了,我小時候因為台商家庭的關係,我在深圳長大,

那時候老師就說了,這裡之後會超越香港,而且是用肯定句現在也成真了,

各別提現在大陸沿海都市發展更早,早就都取代台灣了。




中國只要一個政策就可以把一個國家的產業打死,

官方隨便發布一個『禁韓令』『禁日令』,

加上比台灣嚴重幾百倍的民粹主義,你真以為有國家反抗的了?




在來說說台灣房價,不是也是因為中國崛起而帶動漲勢的?

當房價拖垮生育,生育拖垮教育,這本來就是惡性循環的過程,

跟大學數量沒有關係,大學招收不到學生自然倒閉或轉型,物競天擇,

要說大學美國更多,加社大全美5000多間,怎麼你們就不會嘲笑他們沒競爭力?




最後說結論:當中國崛起,台灣沉淪就是必經過程,抵抗不了的。

但有沒有機會谷底反彈?100%有!

至少各人蠻看好台灣被中國邊緣化這段時間,

台灣不管是企業或是觀光的整合與"再生"。非常令人期待。




因為必須老實說,台灣早就在過度依賴中國的情況下,

失去了太多競爭力,因為過度依賴中國而變的安逸,

這段時間是好是壞各有解讀,但各人認為這個方向是好的。




台灣人可以關注一下如果到時川普當選,國際情勢又會大洗牌了,

也許還會有可以見縫插針的商業契機。