2016年8月31日 星期三

[docker] docker: Error response from daemon: Conflict. The name "" is already in use by container



docker run --name test -e MYSQL_ROOT_PASSWORD=hello -d mysql:5.6

docker: Error response from daemon: Conflict. The name "/test" is already in use by container

使用 docker run 出現 這樣的訊息,因為上次的異常結束 docker ps 可能看到空的

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES


使用 docker ps -a

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
e60e7335dbb6        mysql               "docker-entrypoint.sh"   34 hours ago        Exited (1) 2 minutes ago   3306/tcp            test
d7de7777925f        ubuntu              "/bin/bash"              35 hours ago        Exited (0) 34 hours ago                        angry_bohr


$ docker start e60e7335dbb6
e60e7335dbb6

$ docker exec -it e60e7335dbb6 /bin/bash

或是使用 docker rm 去移除 container

$docker rm e60e7335dbb6

or

$docker rm -f e60e7335dbb6

2016年8月17日 星期三

[elasticsearch] high performance elasticsearch configuration 設計配置


底下列出一份經過tuning 過的 elasticsearch configuration

/etc/elasticsearch/elasticsearch.yml

  • cluster.name: estic12
    • which is used to discover and auto-join other nodes
  • node.name: "pcnode1"
    • You may also want to change the default node name for each node to something like the display hostname. By default Elasticsearch will randomly pick a Marvel character name from a list of around 3000 names when your node starts up
  • node.master: true
  • node.data: false
    • dedicated master nodes
  • path.data: /spare3
    • The location of the data files of each index / shard allocated on the node. Can hold multiple locations.
    • Note, there are no multiple copies of the same data, in that, its similar to RAID 0. Though simple, it should provide a good solution for people that don’t want to mess with RAID. Here is how it is configured:
      • path.data: /mnt/first,/mnt/second
      • Or the in an array format:
        • path.data: ["/mnt/first", "/mnt/second"]
  • discovery.zen.ping.multicast.enabled: false
  • discovery.zen.ping.unicast.hosts: ["tic12-a42.trendmicro.com", "tic12.trendmicro.com", "tic12-a45.trendmicro.com"]
    • The zen discovery is the built in discovery module for elasticsearch and the default. It provides both multicast and unicast discovery as well being easily extended to support cloud environments.

  • threadpool.bulk.type: fixed
  • threadpool.bulk.size: 100
  • threadpool.bulk.queue_size: 320
    • For bulk operations, defaults to fixed size # of available processors. queue_size 50.
    • The fixed thread pool holds a fixed size of threads to handle the requests with a queue (optionally bounded) for pending requests that have no threads to service them.

  • discovery.zen.minimum_master_nodes: 2 #(es_node_num)/2 +1
    • sets the minimum number of master eligible nodes that need to join a newly elected master in order for an election to complete and for the elected node to accept its mastership.
  • indices.memory.index_buffer_size: 30%
    • The indexing buffer setting allows to control how much memory will be allocated for the indexing process.
    • accepts either a percentage or a byte size value. It defaults to 10%, meaning that 10% of the total memory allocated to a node will be used as the indexing buffer size.
  • index.translog.flush_threshold_ops: 50000
    • Each shard has a transaction log or write ahead log associated with it. It allows to guarantee that when an index/delete operation occurs, it is applied atomically, while not "committing" the internal Lucene index for each request.
    • After how many operations to flush.
  • index.refresh_interval: 30s
    • The async refresh interval of a shard.
    • How often to perform a refresh operation, which makes recent changes to the index visible to search.