# docker-cacti **Repository Path**: Coding-01/docker-cacti ## Basic Information - **Project Name**: docker-cacti - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 数据库部分 mysql > create database cacti; mysql >grant all on cacti.* to cacti@'%' identified by '123456'; mysql >grant select on mysql.time_zone_name to cacti@'%' identified by '123456'; mysql >grant select on mysql.time_zone_name to cacti@localhost identified by '123456'; mysql >alter database cacti character set utf8mb4 collate utf8mb4_unicode_ci; mysql >flush privileges; cacti项目部分 shell> git clone --depth=1 git@gitee.com:Coding-01/docker-cacti.git shell> cd docker-cacti/ 修改Dockerfile配置文件的数据库配置 shell> vim Dockerfile .... .... --- ENV --- ENV DB_NAME=cacti \ DB_USER=cacti \ DB_PASS=123456 \ DB_HOST=1.2.3.4 \ #这里为数据库的IP地址 DB_PORT=3306 \ RDB_NAME=cacti \ RDB_USER=cacti \ RDB_PASS=123456 \ RDB_HOST=1.2.3.4 \ #这里为数据库的IP地址 .... .... 构建 shell> docker build -t cacti:v1 . 创建容器 shell> mkdir -p /var/cacti/log   shell> docker run -itd --name cacti -p 80:80 -p 443:443 -v /var/cacti/log:/cacti/log/ cacti:v1 shell> docker exec -it cacti bash Container> sed -i "s/;date.timezone =/date.timezone = Asia\/Shanghai/" /etc/php.ini 配置MySQL shell> vim /usr/local/mysql/my.cnf     #在mysqld段中添加以下内容,数值因硬件配置高低而取决大小 [mysqld] .... .... innodb_flush_log_at_timeout = 3 innodb_read_io_threads = 32 innodb_write_io_threads = 16 tmp_table_size = 125M innodb_buffer_pool_size = 2048M max_heap_table_size = 125M join_buffer_size = 300M innodb_buffer_pool_instances = 22 innodb_io_capacity = 5000 innodb_io_capacity_max = 10000 character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci max_allowed_packet = 16777216 .... .... 保存退出并重启容器 shell> docker restart cacti 重启数据库 shell> service mysql restart 填充time_zone数据库 shell> /usr/local/mysql/bin/mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -uroot -p mysql 浏览器访问 https://xx.xx.x.xxx/cacti (默认帐密为admin/admin)