Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common problems in Linux enterprise production?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Linux enterprise production common problems have what related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will gain after reading this Linux enterprise production common problems articles, let's take a look at it.

1. How to set the tomcat-8.5.9 JVM memory size, write down the setting steps

JAVA_OPTS= "$JAVA_OPTS-Xmx2048m-Xms1024m-Xss512k-XX:NewRatio=4-XX:SurvivorRatio=4"

-Xmx2048m # maximum available memory

-Xms1024m # minimum available memory (maximum and minimum can be set to equivalent)

-Xss512k # stack size of each process

2. Nginx proxy backend CVM, when the client accesses the page and log, there are 504 gateway timeout messages. How to solve this problem? Write out the steps

Let's talk about the reasons for this first. there are many reasons for this kind of situation.

Summarize three major categories:

1: network issu

2: code problem

3: configuration issu

The solution is as follows:

Location / {

..

Proxy_pass http://10.0.0.101:9563

Proxy_connect_timeout 300

Proxy_read_timeout 300

Proxy_send_timeout 300

}

# prevent other errors such as 504500 by setting the proxy connection timeout interval. The default timeout is 60s.

3. How to check whether the files at both ends are completed synchronously, and display and monitor them by configuring zabbix, and write out the ideas and specific configuration steps.

There is no absolute answer to this question, it only depends on whose implementation method is simple, the configuration is less, and the goal is achieved.

My solution is as follows:

1: synchronize client directories and count the number of directories and files find. / | wc-l > file.log

2: synchronize the file.log to the synchronized server in real time, and the same server regularly counts the directory and the number of files find. / wc-l > rsfile.log

3: use the script to determine whether the number size in the two files is the same, print ok > result.log if the same, otherwise print error > result.log

4: zabbix configuration only needs to regularly check whether the number of ok in result is 1, and alarm if it is not 1

# if friends have good ideas and methods, please do not leave a message in the article

4. Using free-mh to find that the cached size is 4G and the available memory is only 5m. How to clear it, write down the steps and comment on it?

# manually release the memory occupied by cached

Use the sync command to write all unwritten system buffers to disk before purging

To free pagecache: echo 1 > / proc/sys/vm/drop_caches

To free dentries and inodes: echo 2 > / proc/sys/vm/drop_caches

To free pagecache, dentries and inodes: echo 3 > / proc/sys/vm/drop_caches

# after manual release, change back to the default 0:echo 0 > / proc/sys/vm/drop_caches

# release the script regularly #

#! / bin/bash

Used= `free-m | awk 'NR==2' | awk' {print $3}'`

Free= `free-m | awk 'NR==2' | awk' {print $4}'`

Echo "=" > > / var/log/mem.log

Date > > / var/log/mem.log

Echo "Memory usage | [Use:$ {used} MB] [Free:$ {free} MB]" > > / var/log/mem.log

If [$free-le 1000]; then

Sync & & echo 1 > / proc/sys/vm/drop_caches

Sync & & echo 2 > / proc/sys/vm/drop_caches

Sync & & echo 3 > / proc/sys/vm/drop_caches

Echo "OK" > > / var/log/mem.log

Else

Echo "Not required" > > / var/log/mem.log

Fi

# #

5. How to create and adjust SWAP partition. Please write down the specific steps.

# how to create and adjust SWAP partitions

# method 1: create a partition file

Dd if=/dev/zero of=/var/swap bs=1024 count=5G

Mkswap / var/swap

Swapon / var/swap

Join / etc/fstab

/ var/swap swap swap defaults 0 0

# method 2: resize the partition in use

# close Partition

Swapoff / dev/mapper/VolGroup-lv_swap

# increase the size

Lvm lvresize / dev/mapper/VolGroup-lv_swap-L + 25000m

# formatting partitions

Mkswap / dev/mapper/VolGroup-lv_swap

# enable Partition

Swapon-va

6. How to set redis to enable remote access

Cd / application/redis/

Vim redis.confg

Bind 127.0.0.1-> # bind 127.0.0.1

Protected-mode yes- > protected-mode no

Restart the service

7. Log in to MySQL database to operate, and there is an error prompt in Too Many Connections. How to solve it? Write out the configuration steps

Vim / etc/my.cnf

Max_connections = 500# adjust the value according to the specific situation

Wait_timeout=5

/ etc/init.d/mysqld restart

This is the end of the article on "what are the common problems in the production of Linux enterprises?" Thank you for reading! I believe you all have a certain understanding of the knowledge of "what are the common production problems in Linux enterprises?" if you want to learn more knowledge, you are welcome to follow the industry information channel.

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: 0

*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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report