• 用kubernetes部署oa 强制删除pod delete -- 参考 MySQL


    1.[root@pserver88 oa]# cat Dockerfile 

    FROM tomcat

    RUN rm -rf /usr/local/tomcat/webapps/*
    ADD ROOT.war /usr/local/tomcat/webapps/

    2.

    [root@pserver78 oa]# cat oa.yaml
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    labels:
    app: oa
    name: oa
    spec:
    replicas: 1
    template:
    metadata:
    labels:
    app: oa
    spec:
    containers:
    - image: harbor.a.com/pub/oa:latest
    imagePullPolicy: IfNotPresent
    name: oa
    ports:
    - name: http
    containerPort: 8080
    serviceAccountName: onecloud
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    labels:
    app: oa-db
    name: oa-db
    spec:
    replicas: 1
    template:
    metadata:
    labels:
    app: oa-db
    spec:
    containers:
    - image: harbor.a.com/pub/oa-db:latest
    imagePullPolicy: IfNotPresent
    name: oa-db
    volumeMounts:
    - name: oa-db-data
    mountPath: /var/lib/mysql/
    ports:
    - name: http
    containerPort: 3306
    env:
    - name: MYSQL_ROOT_PASSWORD
    value: "engine"
    volumes:
    - name: oa-db-data
    persistentVolumeClaim:
    claimName: pvc-oa-db-data
    serviceAccountName: twocloud
    ---
    apiVersion: v1
    kind: Service
    metadata:
    labels:
    app: oa
    name: oa
    spec:
    ports:
    - port: 8080
    targetPort: 8080
    selector:
    app: oa
    ---

    apiVersion: v1
    kind: Service
    metadata:
    labels:
    app: oa-db
    name: oa-db
    spec:
    ports:
    - port: 3306
    targetPort: 3306
    selector:
    app: oa-db
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
    name: ingress-oa
    spec:
    rules:
    - host: oa.mz.pispower.com
    http:
    paths:
    - backend:
    serviceName: oa
    servicePort: 8080
    path: /
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: pvc-oa-db-data
    labels:
    app: oa-db
    spec:
    storageClassName: rook-ceph-block
    accessModes:
    - ReadWriteOnce
    resources:
    requests:
    storage: 5Gi

    3.

    [root@pserver78 oa-db]# cat Dockerfile
    FROM mysql:5.6

    ADD oa20181115all.sql /docker-entrypoint-initdb.d
    #ADD my.cnf /etc/mysql/

    4.

    [root@pserver78 oa-db]# cat my.cnf |egrep -v '^#|^$'
    [client]
    port = 3306
    socket = /var/run/mysqld/mysql.sock # Use mysqld.sock on Ubuntu, conflicts with AppArmor otherwise
    [mysql]
    no_auto_rehash
    max_allowed_packet = 16M
    prompt = 'u@h [d]> ' # 'user@host [schema]> '
    default_character_set = utf8 # Possibly this setting is correct for most recent Linux systems
    [mysqldump]
    max_allowed_packet = 16M
    [mysqld_safe] # Becomes sooner or later obsolete with systemd
    open_files_limit = 8192 # You possibly have to adapt your O/S settings as well
    user = mysql
    log-error = <hostname>_error.log # Adjust AppArmor configuration: /etc/apparmor.d/usr.sbin.mysqld
    [mysqld]
    port = 3306
    socket = /var/run/mysqld/mysql.sock # Use mysqld.sock on Ubuntu, conflicts with AppArmor otherwise
    skip-grant-tables
    skip-name-resolve
    max_allowed_packet = 16M
    default_storage_engine = InnoDB
    character_set_server = utf8 # If you prefer utf8
    max_connections = 505 # Values < 1000 are typically good
    max_user_connections = 500 # Limit one specific user/application
    thread_cache_size = 505 # Up to max_connections makes sense
    query_cache_type = 1 # Set to 0 to avoid global QC Mutex
    query_cache_size = 32M # Avoid too big (> 128M) QC because of QC clean-up lock!
    sort_buffer_size = 2M # Could be too big for many small sorts
    tmp_table_size = 32M # Make sure your temporary results do NOT contain BLOB/TEXT attributes
    read_buffer_size = 128k # Resist to change this parameter if you do not know what you are doing
    read_rnd_buffer_size = 256k # Resist to change this parameter if you do not know what you are doing
    join_buffer_size = 128k # Resist to change this parameter if you do not know what you are doing
    table_definition_cache = 1400 # As big as many tables you have
    table_open_cache = 2000 # connections x tables/connection (~2)
    table_open_cache_instances = 16 # New default in 5.7
    log_error = <hostname>_error.log # Adjust AppArmor configuration: /etc/apparmor.d/usr.sbin.mysqld
    log_warnings = 2
    slow_query_log_file = <hostname>_slow.log # Adjust AppArmor configuration: /etc/apparmor.d/usr.sbin.mysqld
    slow_query_log = 0
    log_queries_not_using_indexes = 0
    long_query_time = 0.5
    min_examined_row_limit = 100
    general_log_file = <hostname>_general.log # Adjust AppArmor configuration: /etc/apparmor.d/usr.sbin.mysqld
    general_log = 0
    performance_schema_consumer_events_statements_history_long = ON # MySQL 5.6 and newer
    server_id = 42
    log_bin = <hostname>_binlog # Locate outside of datadir, adjust AppArmor configuration: /etc/apparmor.d/usr.sbin.mysqld
    binlog_cache_size = 1M
    binlog_stmt_cache_size = 1M
    max_binlog_size = 128M # Make bigger for high traffic to reduce number of files
    sync_binlog = 0 # Set to 1 or higher to reduce potential loss of binary-log data
    expire_logs_days = 5 # We will survive easter holidays
    binlog_format = ROW # Use MIXED if you experience some troubles
    log_slave_updates = 1 # Use if Slave is used for Backup and PiTR
    read_only = 0 # Set to 1 to prevent writes on Slave
    key_buffer_size = 8M # Set to 25 - 33 % of RAM if you still use MyISAM
    myisam_recover_options = 'BACKUP,FORCE'
    max_heap_table_size = 64M # Should be greater or equal to tmp_table_size
    innodb_strict_mode = ON
    innodb_file_format_check = 1
    innodb_buffer_pool_size = 128M # Go up to 80% of your available RAM
    innodb_buffer_pool_instances = 8 # Bigger if huge InnoDB Buffer Pool or high concurrency
    innodb_file_per_table = 1 # Is the recommended way nowadays
    innodb_flush_log_at_trx_commit = 2 # 1 for durability, 0 or 2 for performance
    innodb_log_buffer_size = 8M # Bigger if innodb_flush_log_at_trx_commit = 0
    innodb_log_file_size = 256M # Bigger means more write throughput but longer recovery time

    5.cat oa20181115all.sql

    强制删除pod

    kubectl -n gscommon delete pod oa2gs-6477cfdc9d-rhgj8 --force --grace-period=0

    #################################################

    https://github.com/rook/rook/tree/master/cluster/examples/kubernetes

    mysql.yaml wordpress.yaml

  • 相关阅读:
    UESTC--1267
    HDU--1394
    rvm 安装后的补充工作:source $HOME/.profile
    FFmpeg 初级使用
    Vue 打包部署上线
    阿里云Centos7.6中部署nginx1.16+uwsgi2.0.18+Django2.0.4
    响应式网站设计---Bootstrap
    GitBook简单的使用
    VUE 参数共享问题
    Django之JWT理解及简单应用
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/10045536.html
Copyright © 2020-2023  润新知