11 FAQs about Linux technical support

Source: Internet
Author: User
Tags free ssh secure copy
Article Title: 11 common technical support issues in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Answers the eleven frequently asked questions in Linux technical support, such as multiple startup, performance adjustment, file synchronization, default display mode for changing file lists, clock synchronization for multiple machines, and email backup.
1. I want Apache to provide services for a large number of connections. To reduce the time required to create a process, I set the number of Apache sub-processes to a fixed value of 1000. The system has poor performance and sometimes even denies connection. Do you have any suggestions?
A: It seems that you may have encountered A problem commonly known as "thundering herd. The Apache and Linux documents describe this problem in detail. you can solve it in several ways.
In Linux, this situation is generally developed from the process "wake" (wake-up. When a new connection requires Apache/Linux to provide services, the system sends a notification to all sleeping processes. All these processes attempt to gain control of the new connection. However, only one of them can succeed, and all other processes will fail and go to sleep state. This is called "wake all" (wake up all ). Linux 2.2 and earlier kernels are processed in this way.
When there are few sleeping Apache processes, it will not become a problem. Usually, Apache benefits? * ** The MinSpareServers and MaxSpareServers configuration variables in ttpd. conf adjust the number of sleep processes. However, if the MaxSpareServer value is unusually high, it may cause performance problems. I usually set the MaxSpareServer value to 5% to 10 of the MaxClients value.
If your MaxSpareServers value is unusually high, you can immediately increase performance by reducing this value.
Some kernels do not encounter this problem because they have the ability to wake up one by using the "wake one" command, which allows a process to be awakened for each connection request. BSD has this capability, as is the Linux 2.4 kernel.
To use the "wake one" capability, you must specify a special option when compiling Apache. If Apache is configured for the 2.4 kernel, execute the command following the example below before compiling, which will improve the performance of the kernel with the "wake one" capability:
# CFLAGS = '-DSINGLE_LISTEN_UNSERIALIZED_ACCEPT'./configure
Apache provides many adjustment parameters to provide services for a large number of network connections. Apache has a fixed limit on the maximum number of allowed connections. to set it to greater than 256, you must recompile Apache.
In addition, Linux also needs some file system adjustments to meet the requirements of large-scale services. You also need to check Linux's fixed process, system level, and user level restrictions through compilation.
In short, there are a lot of factors to consider when you make adjustments to a huge number of Apache processes/connections. "Thundering herd" may be the most overlooked problem, but there are many other factors to consider.
For more information about how to adjust Apache to increase the number of connections, visit http://linuxperf.nl.linux.org/webserving.
2. I got an account on the server. Ssh is recommended for administrators. Therefore, telnet and ftp are not allowed for this account. What is ssh? How to use it? Why do they disable telnet?
A: ssh is short for "secure shell". it can replace telnet. Ssh also has a file copy command, scp (Secure Copy), which can be used to move files between different machines.
Because the design of telnet and ftp is not very secure, many administrators disable telnet and ftp. When using telnet and ftp to log on to the server, the password is sent to the server in plain text. malicious users may listen to packets transmitted over the network to obtain the user's logon information. Although this kind of thing is unlikely to happen, we can completely prevent this kind of thing from happening if we use a protocol like ssh.
Ssh and telnet are similar in usage. However, ssh not only encrypts the login name and password, but also encrypts the entire transmission process. Therefore, ssh prevents any third party between you and the server from seeing the transmitted content.
There is a popular free ssh implementation, which belongs to the Ope *** SD system, but can also run on Linux. OpenSSh can be removed from the http://ftp.ope *** sd.org/pub/ope?##sd/...al-solution ).
After installing ssh, we can easily obtain a shell on a remote server using ssh. For example, assume that I execute:
# Ssh dtype@trove.sourceforge.net
First, I saw the system prompt to enter the password, and then I got a shell on the remote machine. From here on, the ssh session process is similar to the telnet session. The difference is that I can be sure that all data transmitted between me and the server has been encrypted.
If you are familiar with rsh and its options, you will soon be able to start using ssh. Ssh is designed to work in the same way as rsh. Generally, programs that can use rsh as the transmission Port can use ssh instead (such as rsync ).
The Secure Copy command scp is easy to use. Its syntax is similar to that of cp. For example, to copy the index. php file to the dtype.org server, run the following command:
# Scp index. php dtype@dtype.org:/usr/local/apache/htdocs/
At this point, we will see the prompt for entering the password (just like ssh ). Next, the index. php file in the current directory of the local machine is copied to/usr/local/apache/htdocs/of dtype.org, and the login name is dtype.
For more information about OpenSSh, see the http://www.openssh.com where you can ?..? Why do I have to go to the South Carolina? /A>
3. I have a portable computer. I want to ensure that the latest data files are available on both the host and desktop. What do you suggest?
A: There is an excellent tool rsync to complete this task. Rsync provides a way to keep the two groups of files the same. It is based on algorithms designed by Andrew Tridgell (founder of the SAMBA project. Andrew Tridgell's algorithm allows only file changes to be transmitted.
Rsync is generally regarded as a standard system tool, so rsync may have been installed on your system. If it has not been installed, then your Linux installation disk should have its package file, or you can also download the latest source from the http://rsync.samba.org ?.. Whether c has been installed.
To keep files synchronized, rsync must be installed on all machines (in this example, your portable computer and desktop. In addition, the two machines should be able to see each other through the network.
I strongly recommend using ssh as the communication mechanism between two machines. However, there are several other methods to configure the rsync transmitter, including the rsh and rsync daemon modes. The rsync documentation details this. For more information, see ssh instructions in this article.
The syntax of the rsync command is similar to that of the cp command. Essentially, you are copying a file from one location to another, but rsync has a few more options that the cp command does not have. The biggest difference between file synchronization and normal file replication is that you must specify a non-local machine (such as your desktop ).
You should carefully consider which files should be synchronized between machines. It is best to put these files in a dedicated directory on a portable computer to avoid synchronizing those files that do not need to be synchronized. For example, your home directory may have hundreds of megabytes of browser buffer data. Generally, you do not want to transmit the data.
I created a/home/drew/data directory on my own desktop machine and used this directory to save all data files. for convenience, I also created the directory on the hosts ?? Which cool muscle?
To use rsync to synchronize files from the desktop to the hosts machine, I enter the following command on the hosts machine:
# Rsync-vazu-e ssh -- delete drew @ brief topname:/home/drew/data // home/drew/data/
This command tells rsync to use ssh to copy the/home/drew/data directory on the desktop to the same directory on the hosts machine. To make this command run smoothly, I must be able to use ssh to access drew @ shorttopname without dependency on rsync. If you cannot, check and ensure that ssh is correctly installed and runs properly.
The following is an analysis of the above commands: the-v option tells rsync to output detailed prompts; the-a option requires rsync to be in "archive" mode, and rsync will copy directories and symbolic connections; the-z option is used to compress data during transmission. the-u option indicates "update only" to prevent rsync from overwriting new files on hosts than on desktops. To make this option work correctly, the system clock of the two machines must be synchronized.
I use the-e ssh option to force rsync to use ssh as the transmission mechanism. By default, rsync uses rsh. The -- delete option is dangerous. it tells rsync to delete all files that do not exist on the desktop on the hosts. When you start using the rsync command, I suggest you do not add this option until you are familiar with the syntax of the rsync command and the consequences of this option.
To synchronize files from the hosts to the desktop, I run a similar command on the desktop:
# Rsync-vazu-e ssh/home/drew/data/drew @ desktop
Name:/home/drew/data/
Note that the -- delete option is omitted this time, because for desktops, I prefer not to use the auto delete function. You may want to add this option, but be careful.
The rsync command has many other options that you can view in the man document or access the http://rsync.samba.org.
4. how can I ensure the system clock synchronization of several machines?
A: The ntpdate program is designed for this purpose and is easy to use. It uses a protocol to query one or more time servers and then sets the correct system time for your machine.
First, you should determine the time server to use. Although you can set your own machine as a time server and use this machine to synchronize the clock of other machines, I do not recommend this. This requires you to complete additional management work on your own, and you must ensure that the time server clock is accurate.
I prefer to refer to those official time servers and synchronize all my machines. You can refer to http://tycho.usno.navy.mil/ntp.html? /A>
The syntax of the ntpdate command is very simple, but it must be run as root. You can specify one or more time servers in the command line. The first three servers in the USNO list are used below. In this way, ntpdate will be able to select the best time server for synchronization.
# Ntpdate ntp2.usno.navy.mil tock.usno.navy.mil tick.usno.navy.mil
14 Nov 17:19:04 ntpdate [16015]: adjust time server 192.5.41.40 offset-0.017641 sec
To ensure accurate clock speed, we can put the ntpdate command into crontab. However, it is more appropriate to run this command in a startup script or manually on a machine that is not always enabled (such as a host.
It must be noted that ntpdate sets the system clock, but it does not set the hardware clock (battery-powered clock ). To make the hardware clock reflect the system clock value, run the following command:
# Hwclock-systohc
If ntpdate has not been installed on the system, it should be able to be installed from the Linux installation disk. For more information about the ntpdate command, see the man document of this command.
5. on a dual-start machine
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.