Big Kaiyun Blog https://blog.dakaiyun.cn/ zh-CN All difficulties are tests. When you go through all difficulties to reach the goal, you will naturally understand that what you deserve is right in front of you. Tue, 09 Apr 2024 16:59:00 +0800 Tue, 09 Apr 2024 16:59:00 +0800 Wiznote Private Deployment (Docker) Password Reset for Notebook https://blog.dakaiyun.cn/archives/180/ https://blog.dakaiyun.cn/archives/180/ Tue, 09 Apr 2024 16:59:00 +0800 Da Kai The blogger privately deployed an open source wiz note, but because it has not been used for a long time, the password has been forgotten (...)

Let's share the whole process of resetting and record it.

  1. Entering the container

     docker exec -it wiz /bin/bash

    Cat/wiz/app/entrypoint.sh View the startup script of wiznote in the container, which contains the login password (the user is root)

  2. [In container] Log in to the database and change the root password to 123456

     mysql>use wizasent; mysql> UPDATE wiz_user SET PASSWORD = "a9da87c000d58437ffd94b020dc221c9" WHERE ID = '1';
]]>
zero https://blog.dakaiyun.cn/archives/180/#comments https://blog.dakaiyun.cn/feed/
Solve the problems of Navicat importing date format changing to 1900 and error reporting https://blog.dakaiyun.cn/archives/175/ https://blog.dakaiyun.cn/archives/175/ Tue, 15 Aug 2023 15:56:00 +0800 Da Kai The situation encountered is that the data in the Excel data source table is imported into the database table through Navicat software, and the time field is 1900-00:00 17:21:10

Situation screenshot

Solution

Change the date sorting to "* YMD* ”, date separator changed to "* -*

]]>
one https://blog.dakaiyun.cn/archives/175/#comments https://blog.dakaiyun.cn/feed/
Harbor warehouse deployment and installation https://blog.dakaiyun.cn/archives/167/ https://blog.dakaiyun.cn/archives/167/ Tue, 15 Aug 2023 15:43:00 +0800 Da Kai Basic environment

Install Docker

 #Install Docker ce Community Edition yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin #Start the docker service systemctl start docker #View Docker Version docker -v

Install Docker Compose

 #Install docker compose yum -y install docker-compose

Harbor installation

Download link: https://github.com/goharbor/harbor/releases
 #Create the decompression directory Harbor mkdir /home/harbor #Enter the decompression directory Harbor cd /home/harbor #Unzip the compressed package to the Harbor directory under the current directory tar -zxvf harbor-offline-installer-v2.8.3.tgz

Edit Profile

 [ root@nginx  harbor]# vi harbor.yml

 Edit Profile

Start project

 ./install.sh

 Wait for installation to complete

Connection Information

  • User name: admin
  • password: Habor@12345

Docker push image

 #Log in to the harbor warehouse docker login 192.168.0.8:88 #Mark the image in the project: docker tag SOURCE_IMAGE[:TAG] 192.168.0.83:88/library/REPOSITORY[:TAG] eg:  docker tag posdk:v2.0 192.168.0.83:88/library/posdk:v2.0 #Push image to current project: docker push 192.168.0.83:88/library/REPOSITORY[:TAG] eg: docker push 192.168.0.83:88/library/posdk:v2.0

common problem

  • Docker login problem: Error response from daemon: Get https://: http: server give HTTP response to HTTPS client
 #Edit daemon.json vi /etc/docker/daemon.json #The contents are as follows { "registry-mirrors": [" https://tr48y1nm.mirror.aliyuncs.com "], "insecure-registries":[" http://192.168.0.83:88 "] } #Reload daemon systemctl daemon-reload #Restart Docker systemctl restart docker
]]>
zero https://blog.dakaiyun.cn/archives/167/#comments https://blog.dakaiyun.cn/feed/
Docker packages and deploys its own projects (java and mysql projects) https://blog.dakaiyun.cn/archives/152/ https://blog.dakaiyun.cn/archives/152/ Mon, 14 Aug 2023 19:24:30 +0800 Da Kai Deploy MySQL

Download MySQL

 [ root@localhost  mysql]# docker pull mysql:5.7

Create containers and mount data volumes

 docker run -itd --restart=always --name mysqlServer -p 3306:3306  -v /home/mysql/data:/var/lib/mysql  -v /home/mysql/conf:/etc/mysql  -v /home/mysql/log:/var/log/mysql  -e TZ=Asia/Shanghai  -e MYSQL_ROOT_PASSWORD=xxxxx mysql:5.7

Create User

 #Create User CREATE USER 'zhangsan'@'%' IDENTIFIED BY '8932xxxx'; #Authorize specific users specific databases GRANT ALL PRIVILEGES ON dkpos.* TO 'posdk'@'%'; #Refresh Authorization flush PRIVILEGES;

Write Dockefile

 FROM openjdk:8-jdk-slim LABEL maintainer=tongdakai ENV TIME_ZONE Asia/Shanghai COPY ./ posDk.jar /posDk.jar ENTRYPOINT ["java","-jar","/posDk.jar"]

Package your own image

 docker build -t posdk:v1.0 .

Run your own project

 docker run -itd -p 8875:8875 -v /home/dkpos/log:/home/dakai/logs -v /home/dkpos/data:/home/posDk --name dkPos --restart=always posdk:v1.0
]]>
zero https://blog.dakaiyun.cn/archives/152/#comments https://blog.dakaiyun.cn/feed/
Prometheus and grafana build server monitoring system https://blog.dakaiyun.cn/archives/140/ https://blog.dakaiyun.cn/archives/140/ Fri, 16 Jun 2023 00:04:00 +0800 Da Kai Building grafana+prometheus monitoring resources and rapid deployment based on docker

Basic server information

  • Service action port (default)
  • Prometheus main server 9090
  • Node_Exporter is responsible for collecting host hardware information and operating system information 9100
  • MySqld_Exporter is responsible for collecting mysql data information 9104
  • The Cadvisor is responsible for collecting Docker container information running on the Host8080
  • Grafana is responsible for displaying Prometheus monitoring interface 3000
  • Altermanager waits to receive the alarm information sent by prometheus, and then sends it to the defined recipient 9093

Prometheus

 #Start container setting port docker run -itd --name docker_prometheus --restart=always -p 9090:9090 -v $PWD/prometheus:/etc/prometheus/ prom/prometheus #Docker run #-- name The name of the container #- p Specifies the port mapping of the container #- v Map the local path to the container (so that if the local file is modified, it only needs to restart the container to take effect in the container) #-- restart The container restart policy no does not restart. Always restart when always exits #Prom/prometheus Select the image name to start the container (the latest will be added after the default image if you pull the image you created)

Grafana

 #Start container setting port docker run -itd --name=grafana --restart=always -p 3000:3000 -v $PWD/grafana-storage:/var/lib/grafana grafana/grafana #Docker run #-- name The name of the container #- p Specifies the port mapping of the container #- v: Mount the host directory and the directory in the docker container$ PWD/grafana storage: local host absolute directory/ Var/lib/grafana: container directory (mount the container directory locally) #-- restart Container restart policy No: Do not restart, always: Always restart when exiting #Grafana/grafana Select the image name to start the container #Add directory permission (not adding permission is not enough, and the container cannot be started) chmod -R 777 grafana-storage
Node_export is an export of Prometheus, which is mainly used to collect the usage of server hardware resources. So this is often deployed to the monitored server. That is, grafana and Prometheus will be independently deployed on a single machine, and node_export will be deployed on the monitored server to collect the monitored server resource data, send it to Prometheus, and then display it through grafana

node_exporter

 ##Start node exporter docker run -d --name node-exporter --restart=always -p 9100:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" prom/node-exporter

Configure Prometheus+node_exporter to collect data

Modify the configuration file (by modifying the file, connect prom and node_exporter together, collect data through the latter, transmit it to the former, and finally present it in grafana)

 vim prometheus/prometheus.yml

Here I will give you a general picture. This is the effect picture after all my configurations are completed. You can take what you need and use this picture only later. Here we can see that the parameters of endpoint and labels are actually the parameters configured in prometheus.yml.

Configuring the Granfan Panel

  • Login to granfana Username Password defaults to admin
  • Settings – Data Source – Add Data Source
  • Select Prometheus and add http://ip:9090
  • Select data display template and add template

Template address 1: (or direct import ID: 8919)
Template address 2: (or directly import ID: 11074)
I'll fill in the figure later

]]>
zero https://blog.dakaiyun.cn/archives/140/#comments https://blog.dakaiyun.cn/feed/
MySQL database scheduled backup script (linux) https://blog.dakaiyun.cn/archives/137/ https://blog.dakaiyun.cn/archives/137/ Thu, 15 Jun 2023 18:26:00 +0800 Da Kai Write a MySQL database script with GhatGpt and cooperate with the scheduled task crontab to achieve scheduled backup of the database. Record
 #!/ bin/bash #MySQL database backup script 2023.6.13 #Database user name DB_USER="xxx" #Database password DB_PASS="xxx" #Database name DB_NAME="xxx" #Backup directory BACKUP_DIR="/home/backup/data/blog" #Backup file name BACKUP_FILE="$DB_NAME-$(date +%Y%m%d%H%M%S).sql" #Create a backup directory (if it does not exist) mkdir -p $BACKUP_DIR #Backup database mysqldump -h ip -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$BACKUP_FILE #Compress backup files gzip $BACKUP_DIR/$BACKUP_FILE #Delete backup files 7 days ago find $BACKUP_DIR -type f -name "*.gz" -mtime +7 -delete

Script Reference

Mysql

  • Description Backup script
  • Backup a single mysqldump - h192.168.1.11 - uroot - p # {PWD} db name># {DATE}. sql
  • Backup all mysqldump - h192.168.1.11 - uroot - p # {PWD} -- all databases># {DATE}. sql
  • Restore mysql - uroot - p123456 db name<2021-11-12_10_29.sql

postgres

  • Description Backup script
  • Backup a single PGPASSWORD="# {PWD}" pg_dump -- host 192.168.1.11 -- port 5432 -- dbname db name -- user postgres -- clean -- create -- file # {DATE}. sql
  • Backup all PGPASSWORD="# {PWD}" pg_dumpall -- host 192.168.1.11 -- port 5432 -- user postgres -- clean -- file # {DATE}. sql
  • Restore psql - U postgres - f 2021-11-12_10_29.sql
  • Restore specified psql - U postgres - d dn name - f 2021-11-12_10_29.sql

Scheduled task

  • crontab -e
 #Execute the backup script to back up the database at 44 am every day 44 0 * * * /bin/bash /home/baksh/bakBlog.sh
  • crontab -l
    View Scheduled Tasks
]]>
zero https://blog.dakaiyun.cn/archives/137/#comments https://blog.dakaiyun.cn/feed/
Php7.2 Installation Tutorial (valid through personal testing) https://blog.dakaiyun.cn/archives/133/ https://blog.dakaiyun.cn/archives/133/ Wed, 14 Jun 2023 00:32:00 +0800 Da Kai This installation tutorial adopts source code compilation and installation, and is effective through personal testing. record

install

  1. Installation Dependencies

     yum install -y gcc make autoconf libtool-ltdl-devel libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel openssl-devel openldap-devel postgresql-devel sqlite-devel libxslt-devel libzip-devel
  2. Download the source code package of PHP 7.2

     wget  https://www.php.net/distributions/php-7.2.34.tar.gz
  3. Extract the source code package to a directory

     tar -zxvf php-7.2.34.tar.gz
  4. Enter the unzipped directory and run the following command to configure:

     cd php-7.2.34 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir= /usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-libdir=lib64 --with-xmlrpc --enabl e-zip --enable-soap --with-gettext --disable-fileinfo #Note that the parameters in the above command are adjusted according to the actual situation.
  5. Run the following command to compile and install

     make && make install
  6. Copy the php configuration file and

     cp php.ini-development /usr/local/php/etc/php.ini
  7. Configure php fpm

     cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
  8. Start php fpm

     /usr/local/php/sbin/php-fpm

    Check whether the port 9000 has been started, netstat - an | grep 9000. If it is started, it is successful.

     [ root@lamp  ~]# netstat -an |grep 9000 tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN
  9. Configure Nginx to support php fpm

     Add the following to the Nginx configuration file: location ~ \.php$ { fastcgi_pass   127.0.0.1:9000; fastcgi_index  index.php; fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name; include        fastcgi_params; }
  10. Restart Nginx

     systemctl restart nginx

    11. Check whether the php installation is successful

     /usr/local/php/bin/php -v

    Now the installation of php7.2 is complete!

    Registration Service

  • Switch to this directory

     cd usr/lib/systemd/system
  • The specific reference for creating files is as follows

     [ root@VM-24-5-centos  system]# cat php-fpm.service  [Unit] Description=php-fpm After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/php/sbin/php-fpm ExecStop=pkill -9 php-fpm [Install] WantedBy=multi-user.target
  • Refresh or re serve

]]>
zero https://blog.dakaiyun.cn/archives/133/#comments https://blog.dakaiyun.cn/feed/
Virtualization platform server disk expansion ext4 partition https://blog.dakaiyun.cn/archives/128/ https://blog.dakaiyun.cn/archives/128/ Thu, 25 May 2023 00:22:34 +0800 Da Kai Some time ago, a production server of the company. Colleague Xiao Wang's monitoring platform found that the disk space was soon full again, accounting for 93%. At this time, he told Xiao Tong. As a server administrator, Xiao Tong has to consider the problem of disk expansion, but he is also very good. For the first time, he took over the problem that the server disk in the Linux production environment is full. (In this process, there are also some small episodes, snapshots! Snapshots!) After several queries, ChatGpt finally provided a high-quality solution in the dead of night. Temporary surface discharge, recorded~

Environmental Science

Used by the company's servers linux Centos7 , running on the virtualization super fusion platform. adopt df -Th The disk partition type obtained is ext4

operation

  • First, when there are few people, turn off the virtual machine to add storage (I directly expand the capacity of an existing disk) and turn it on! The capacity is available but cannot be used directly
  • ChatGPT scheme

    1. Use the fdisk command on a Linux server to view the disk partition information: sudo fdisk - l
    2. Use the fdisk command to partition and expand the disk: sudo fdisk/dev/vda
    3. Enter p to view the partition table and record the structure and size of the current partition.
    4. Enter d to delete the current partition. Note that only the last partition can be deleted.
    5. Enter n to create a new partition.
    6. Select the partition type, and enter p to indicate the primary partition.
    7. Select the partition number, and enter 1 to indicate the first partition
    8. Enter the starting sector. The default is the starting position of the current sector.
    9. Enter the termination sector. You need to enter a new sector termination location. You can enter "+100G" to increase the partition size by 100G
    10. Enter w to save the changes and exit fdisko
    11. Use the resize2fs command to expand the file system: sudoreresize2fs/dev/vdal
    12. Wait for the expansion process to complete
    13. Use the df command to check the usage of the file system and confirm that the expansion is successful.
  • Perfect expansion succeeded

 Capacity expansion completed

]]>
one https://blog.dakaiyun.cn/archives/128/#comments https://blog.dakaiyun.cn/feed/
Computer storage https://blog.dakaiyun.cn/archives/124/ https://blog.dakaiyun.cn/archives/124/ Wed, 24 May 2023 23:28:00 +0800 Da Kai I have been waiting for a long time to finish the whole DIY desktop computer tutorial, but I was lazy:: tmemoji: smilecry::

The list of self saved desktop hosts is shown in the figure below. There are things you like for reference, and daily use is completely OK. It has been used for more than half a year


A picture of daily use, with my keyboard and mouse, invincible.

]]>
zero https://blog.dakaiyun.cn/archives/124/#comments https://blog.dakaiyun.cn/feed/
Unable to continue code execution because vcruntime140.dll could not be found https://blog.dakaiyun.cn/archives/126/ https://blog.dakaiyun.cn/archives/126/ Wed, 24 May 2023 23:14:25 +0800 Da Kai Recently, an error occurred when running with CMD, and the prompt "VCRUNTIME140.dll cannot be found, so code execution cannot continue. Reinstalling the program may solve this problem." Obviously, reinstalling does not solve this problem. After many attempts, I finally found something useful, tested it effectively and recorded it.

reason

The vcruntime140.dll file, that is, the dynamic link library file, is missing from the system. The cause of the loss may be the accidental killing of the anti-virus software. If a dll file is missing from the computer, some software, games and other programs may not start and run normally, and the computer system may pop up an error

solve

The solution is very simple. We just need to download the latest Visual C++installation from Microsoft.

 2023-05-24T14:52:47.png

]]>
zero https://blog.dakaiyun.cn/archives/126/#comments https://blog.dakaiyun.cn/feed/