In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Installation script
Ubuntu / Centos
There seems to be a problem with the installation of Debian, and the installation source needs to be solved.
Curl-fsSL https://get.docker.com-o get-docker.shsudo sh get-docker.sh-- mirror Aliyun / AzureChinaCloud
If you are in overseas AWS or GCP and other cloud server manufacturers,-- mirror does not need to be added.
After the Centos has finished running, you still need manual sudo systemctl start docker.service, otherwise it will prompt docker that there is no error like startup.
Log correlation
Grep String
Correct posture: docker logs nginx 2 > & 1 | grep "127."
For example, check Jupyter Notebook's token: docker logs notebook 2 > & 1 | grep "token"
Other supported parameters
-f: similar to the tail-f command
-- since: starting from a timestamp, such as 2013-01-02T13:23:37 also supports relative time, such as 42m
-- until: similar to the above, but vice versa.
-t,-- timestamp: displays the timestamp
-- tail N (default all): displays the last few rows of data
The skills of Mount
For example, Grafana and so on, bring some files with you in docker image. If the directory corresponding to the direct mount and the host directory is empty, then the docker internal
The directory will be overwritten. How to deal with this situation?
Simple and rough method 1: (idea only)
Run it once, and then use the docker cp command to copy it out
Then delete the docker container, copy the files to the corresponding directory, and then mount
A more elegant approach 2:
Take starting ClickHouse as an example
# Step 1.1: create a docker volume (purpose: expose the configuration of CH Server) docker volume create-- driver local\-- opt type=none\-- opt device=/home/centos/workspace/clickhouse/configs\-- opt o=bind\ ch-server-configs# Step 1.2: create volume Mount database data docker volume create-- driver local\-- opt type=none\-- opt device=/home/centos/workspace/clickhouse/data\-- opt o=bind\ ch-server-data# Step 2: start (note: when more data is stored The second startup will take a long time to initialize. The attempt to link will fail before the initialization ends. ) sudo docker run-d-name mkt-ch-server\-v ch-server-configs:/etc/clickhouse-server\-v ch-server-data:/var/lib/clickhouse\-- restart always\-p 9000 ch-server-data:/var/lib/clickhouse 9000-p 8123 ch-server-configs:/etc/clickhouse-server 8123\-- ulimit nofile=262144:262144 yandex/clickhouse-server
In this way, the configuration files that come with the docker image will not be emptied during the first mount.
Scheduled task
For example, mysql needs to export data backups regularly. This operation is best done by using the crond of the host computer.
0 1 * docker exec mysqldump xxxx
Common Docker images and their installation commands
MySQL
Installation
Docker run-- name some-mysql-- restart always\-v / my/own/datadir:/var/lib/mysql\-e MYSQL_ROOT_PASSWORD=my-secret-pw-d mysql:tag
Dump data
Mode 1: mysql docker container already exists locally
The following command is for mysql within docker, or you can specify the parameter dump remote mysql directly
Docker exec some-mysql sh-c 'exec mysqldump-- all-databases-uroot-p "$MYSQL_ROOT_PASSWORD" > / path-to-data/all-databases.sql
Mode 2: there is no mysql docker container locally.
# delete it after use, and enter the password docker run-I-- rm mysql:5.7 mysqldump-- all-databases\-h 172.17.0.1-uroot-p at the command line prompt | gzip-9 > / home/centos/workspace/mysql-data/backup.sql.gz
Editor reason, the above > is not displayed correctly
Restore data
Still refer to the way Dump above, except that the command line tool has been changed to mysql
Python Proxy
It's more or less necessary to build some reptiles. Make full use of the IP of the CVM to act as a crawler agent. The easiest way to build a crawler agent has been found so far:
Docker run-- name py-proxy-d-- restart always-p 8899pur8899 abhinavsingh/proxy.py
Note:
Up to now, the python script for this docker image is still old and does not support basic auth. If you need basic auth, you need to update the python file yourself and re-docker build it. Github address: https://github.com/abhinavsingh/proxy.py in the actual production, too much seems to be automatically unable to link the situation. It could also be the problem with the target site. This thing can also be used as a proxy for the browser SwitchSharp, but it is recommended to add https + basic auth. Please refer to the official documentation for specific operation.
Jupyter Notebook
After using it for a circle, it feels that it is relatively simple to mirror the Notebook that comes with tensorflow. Because there are no weird permission issues when you are in the mount host directory. Bash script is as follows:
Sudo docker run-- name notebook-d-- restart always\-p 127.0.0.1 purl 8888 path-to-workspace/notebooks:/tf tensorflow/tensorflow:latest-py3-jupyter
If you also need to link to Apache Spark, etc., please refer to the following Script
Sudo docker run-- name pyspark-notebook-d\-- net host-- pid host-e TINI_SUBREAPER=true-p 8888purl 8888\-v / path-to-workspace/notebooks:/tf\ tensorflow/tensorflow:latest-py3-jupyter
Grafana
ID=$ (id-u) docker run\-d-restart always\-p 3000 restart always 3000\-- name=grafana\-- user $ID-v / path-to-data/grafana-data:/var/lib/grafana\-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource"\-e "GF_SECURITY_ADMIN_PASSWORD=aaabbbccc"\ grafana/grafana
Some simple explanations:
-user $ID must be set, otherwise permission issueGF_INSTALL_PLUGINS will appear inside docker: install some plug-ins that are not included with GF_SECURITY_ADMIN_PASSWORD: account: admin / aaabbbccc
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 216
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.