You can then specify the location and format of a log file by using the CustomLog
directive:
CustomLog logs/access_log common
If it isn't specified as an absolute path, the location of the log file is assumed to be relative to the ServerRoot
.
Related Fedora and Linux Commands
You will use these commands when managing your Apache web server in Fedora:
► apachectl
— Server control shell script included with Apache
► system-config-httpd
— Red Hat's graphical web server configuration tool
► httpd
— The Apache web server
► konqueror
— KDE's graphical web browser
► elinks
— A text-based, graphical menu web browser
► firefox
— The premier open source web browser
► http://news.netcraft.com/archives/web_server_survey.html— A statistical graph of web server usage points out that Apache is, by far, the most widely used server for Internet sites.
► http://www.apache.org/— Extensive documentation and information about Apache are available at The Apache Project website.
► http://apachetoday.com/— Another good Apache site. Original content as well as links to Apache-related stories on other sites can be found at Apache Today's site.
► http://modules.apache.org/— Available add-on modules for Apache can be found at The Apache Module Registry website.
There are several good books about Apache. For example, see Apache Server Unleashed (Sams Publishing), ISBN 0-672-31808-3.
CHAPTER 18
Administering Database Services
This chapter is an introduction to MySQL and PostgreSQL, two database systems that are included with Fedora. You'll learn what these systems do, how the two programs compare, and how to consider their advantages and disadvantages. This information can help you choose and deploy which one to use for your organization's data base needs.
The database administrator (DBA) for an organization has several responsibilities, which vary according to the size and operations of the organization, supporting staff, and so on. Depending on the particular organization's structure, if you are the organization's DBA, your responsibilities might include the following:
► Installing and maintaining database servers— You might install and maintain the database software. Maintenance can involve installing patches as well as upgrading the software at the appropriate times. As DBA, you might need to have root access to your system and know how to manage software (refer to Chapter 2, "Fedora Quick Start"). You also need to be aware of kernel, file system, and other security issues.
► Installing and maintaining database clients— The database client is the program used to access the database (you'll learn more about that later in this chapter, in the section "Database Clients"), either locally or remotely over a network. Your responsibilities might include installing and maintaining these client programs on users' systems. This chapter discusses how to install and work with the clients from both the Linux command line and through its graphical interface database tools.
► Managing accounts and users— Account and user management includes adding and deleting users from the database, assigning and administering passwords, and so on. In this chapter, you will learn how to grant and revoke user privileges and passwords for MySQL and PostgreSQL while using Fedora.
► Ensuring database security— To ensure database security, you need to be concerned with things such as access control, which ensures that only authorized people can access the database, and permissions, which ensure that people who can access the database cannot do things they should not do. In this chapter, you will learn how to manage Secure Shell (SSH), web, and local GUI client access to the database. Planning and overseeing the regular backup of an organization's database and restoring data from those backups are other critical components of securing the database.
► Ensuring data integrity— Of all the information stored on a server's hard disk storage, chances are the information in the database is the most critical. Ensuring data integrity involves planning for multiple-user access and ensuring that changes are not lost or duplicated when more than one user is making changes to the data base at the same time.
A Brief Review of Database Basics
Database services under Linux that use the software discussed in this chapter are based on a client/server model. Database clients are often used to input data and to query or display query results from the server. You can use the command line or a graphical client to access a running server. Databases generally come in two forms: flat file and relational. A flat file database can be as simple as a text file with a space, tab, or some other character delimiting different parts of the information. One example of a simple flat file database is the Fedora /etc/passwd
file. Another example could be a simple address book that might look something like this:
Doe-John-505 Some Street-Anytown-NY-12345-555-555-1212
You can use standard Unix tools such as grep
, awk
, and perl
to search for and extract information from this primitive database. Although this might work well for a small data base such as an address book that only one person uses, flat file databases of this type have several limitations:
► They do not scale well— You do not have random access to data in flat file data bases. You have only sequential access. This means that any search function has to scan each line in the file, one by one, to look for specific information. As the size of the database grows, access times increase and performance decreases.
► Flat file databases are unsuitable for multi-user environments— Depending on
how the database is set up, it either enables only one user to access it at a time or allows two users to make changes simultaneously, making changes that could end up overwriting each other and causing data loss.
These limitations obviously make the flat file database unsuitable for any kind of serious work in even a small business — much less in an enterprise environment. Relational databases, or relational database management systems (RDBMSs), to give them their full name, are good at finding the relationships between individual pieces of data. An RDBMS stores data in tables with fields much like those in spreadsheets, making the data searchable and sortable. RDBMSs are the focus of this chapter.
Oracle, DB2, Microsoft SQL Server, and the freely available PostgreSQL and MySQL are all examples of RDBMSs. The following sections discuss how relational databases work and provide a closer look at some of the basic processes involved in administering and using databases. You will also learn about SQL, the standard language used to store, retrieve, and manipulate database data.
How Relational Databases Work
An RDBMS stores data in tables, which you can visualize as spreadsheets. Each column in the table is a field; for example, a column might contain a name or an address. Each row in the table is an individual record. The table itself has a name you use to refer to that table when you want to get data out of it or put data into it. Figure 18.1 shows an example of a simple relational database that stores name and address information.
Читать дальше