


How to troubleshoot problems by viewing logs during server operation and maintenance
The content of this article is about how to troubleshoot problems by checking logs during server operation and maintenance. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Basic Guide to Server Operation and Maintenance
As a developer, it is inevitable to operate the server. The most common operation is to deploy applications to servers and troubleshoot problems by viewing logs in production and test environments.
Generally, servers have Linux operating systems and no graphical interface, so any operation is done through the command line. Since the new generation of programmers start with the graphical interface, they start using the command line. If you are used to using the command line, you can do many interesting and efficient things using the command line, improve productivity, and allow programmers to focus more on high-tech work.
Linked server entrance
Mac can log in to the server directly using its own terminal. Windows requires downloading tools, for example:
Password-free login
- ssh -l user ip/domain name
- ssh: secure shell secure shell protocol, designed for remote login sessions A protocol that provides security for other network services. The use of ssh protocol can effectively prevent information leakage during remote management.
Log in with password
Enter: ssh -l user ip/domain name
user: login user name
ip/domain name: Server belongs The public network ID address, or the domain name of the application. If you want to view the IP after domain name resolution, enter ping domain name on the command line to view the public network IP to which the application belongs (provided that the server does not perform load balancing, proxy...). The terminal will prompt you to enter the password. Enter the password at this time. If the password is correct, you can log in to the server.
Password-free login
Password-free login method still requires you to enter a password to log in for the first time. The difference is that after logging in, you add your own key to the server, and you can use it without a password next time. Log in.
Generate ssh key
Log in to the server, enter .ssh in the ~ directory, open the authorized_keys file, create it if it does not exist, and add your public key to authorized_keys. When you use ssh to enter the server again, you can log in directly without entering a password. Tips: Mac can create a new .sh file, add ssh -l user ip/domain name to the .sh file, put it on the desktop and use the terminal to open it by default. In the future, you can double-click the .sh file to directly enter the server (you can even Write other commands in .sh to achieve automation). Exit the server exitexitView the current directory location pwd
pwd
Display all files in the current directory ls
ls: List all files in the current directory
ls -l: List all files and file details in the current directory
Enter and exit the directory cd
cd .. :Return to the upper directory
cd /.: Return to the root directorycd directory name: Enter the specific directory
Create a new directory mkdir
mkdir file/filename
Start the running script./
./xx.sh
View file content cat/tail
cat xxx.xx: View all contents of the file
tail -n number of lines xxx.xxx: View the number of xx lines at the end of the file
vi/vim xxx.xxx: View and modify the file content
Move the file to a specific directory mv
mv xx sss: Move the xx file to the sss directory
It is recommended that when deleting a file, you first move the file to the /tmp directory (the temporary directory of Linux will be cleared when you shut down, so it is recommended to delete it in this directory).
Delete files rm
rm -f xxx: forcefully delete files
rm -rf xxx: -r means downward recursive deletion -f delete without prompt Note: rm - rf (without parameters) will delete the entire system. Even if there are parameters, Linux does not have the concept of a recycle bin. Use with caution
rm -f
.: Use the plum blossom method with caution, it may be deleted by mistake. Delete the entire server
Modify the user permissions of the file chown/chmod
chown -R user:user file: Modify the user permissions of the file File supports wildcards
chmod 777 xxxx:Change File permission 777 means high permissions (read, write, execute). The logged-in user's group and others have the highest permissions. (A more dangerous operation)
View the related processes of the java program jpsjps: View the java program process
Copy the file to the specific directory cp/scp
cp -r copyed copy: Copy copied to the copy directory
scp xxx root:ip:/directory: Copy xxx to the remote ip server directory
Start the service, close the terminal, and continue running nohup
Sometimes we need to run some jar packaged applications on the server. The application will be closed after closing the terminal. We can add nohup before the command to start the jar application
Decompress/compress the file unzip/zip
unzip -o xxx.xx -d sss: Decompress the file xxx.xx to sss and overwrite all
zip -r xxx.zip ./*: Compress all files in the current directory of the file
If the unzip zip command is not executed, you can install unzip/zip
yum install -y unzip zip
Summary
At present, these commands can basically meet the daily development of Yunxi server, but these are just some simple commands to operate the server. If there is more demand to learn Linux systematically, that is also a big problem. Topic operation and maintenance.
The above is the detailed content of How to troubleshoot problems by viewing logs during server operation and maintenance. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Solving the problem of slow Photoshop startup requires a multi-pronged approach, including: upgrading hardware (memory, solid-state drive, CPU); uninstalling outdated or incompatible plug-ins; cleaning up system garbage and excessive background programs regularly; closing irrelevant programs with caution; avoiding opening a large number of files during startup.

The MySQL connection may be due to the following reasons: MySQL service is not started, the firewall intercepts the connection, the port number is incorrect, the user name or password is incorrect, the listening address in my.cnf is improperly configured, etc. The troubleshooting steps include: 1. Check whether the MySQL service is running; 2. Adjust the firewall settings to allow MySQL to listen to port 3306; 3. Confirm that the port number is consistent with the actual port number; 4. Check whether the user name and password are correct; 5. Make sure the bind-address settings in my.cnf are correct.

The solution to MySQL installation error is: 1. Carefully check the system environment to ensure that the MySQL dependency library requirements are met. Different operating systems and version requirements are different; 2. Carefully read the error message and take corresponding measures according to prompts (such as missing library files or insufficient permissions), such as installing dependencies or using sudo commands; 3. If necessary, try to install the source code and carefully check the compilation log, but this requires a certain amount of Linux knowledge and experience. The key to ultimately solving the problem is to carefully check the system environment and error information, and refer to the official documents.

Pull vertical guides in Photoshop: Enable ruler view (View > ruler). Hover the mouse over the vertical edge of the ruler, and then the cursor becomes a vertical line with double arrows and hold and drag the mouse to pull out the reference line. Click Delete by dragging the guide, or hovering it into a cross.

The main reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

The secrets to mastering Office software include: understanding different versions and platforms, correctly installing and configuring, proficient in using the software interface, in-depth understanding of feature operations, application collaboration and sharing functions, utilizing templates and styles, mastering advanced skills, and solving common problems. In addition, you need to choose a version that suits your needs, make good use of templates and styles, develop backup habits, and learn shortcut keys and advanced techniques to improve efficiency.
