I. Introduction to RAC
1, high availability
refers to a comprehensive solution that integrates hardware and software technologies. It guarantees that the application (service) can run uninterrupted without losing data, that is, the effectiveness of the service or the sustainable access of the service.
Features: Reliability: Reliable hardware and reliable software
recoverability: Provides a variety of mechanisms to Ensures that lost data and failed processes can be recovered from failures
error Auto-detect: can automatically detect various errors and take appropriate measures
Sustainability: When some components fail, they can continue to serve the outside world
Oracle HA Solutions: Oracle Golden Gate, Oracle Data Guard, Oracle Stream replication, and Oracle Real application Cluster (RAC)
(1) Oracle Golden Gate is a log-based, structured data-replication backup software that obtains incremental changes to data by parsing the online Redo of the source database or the archive log, and then applying those changes to the target database. This allows the source database to synchronize with the target database.
(2) Oracle Data Guard is typically made up of two machines, one named primary database, the other called Standby database, and two machines for the replication relationship. When the primary database is down, standby database can replace primary database, providing uninterrupted service to the outside.
(3) Oracle stream replication is called stream replication, which is a replication technology based on Message Queuing
(4) Oracle cluster (RAC) is a common solution for HA, It enables high availability of databases through a range of technologies, such as shared storage.
2, Oracle cluster
an Oracle cluster (RAC) is usually composed of multiple servers (each server is called a "node"), and multiple servers form a single unit to provide services externally.
But externally, it seems that there is only one machine. The inside of the cluster is complex, but the external access interface is simple. A cluster can support a maximum of 100 nodes.
nodes communicate over private networks, and the database is placed on shared storage. Each node in the cluster runs an instance (instance), each with its own memory and process.
multiple instances in a cluster can access the databases on the shared storage in parallel. Typically, one database corresponds to one instance, but in a RAC environment, one database corresponds to multiple instances.
RAC Benefits:
(1) High availability: Combined with hardware (RAID) technology, when a hard drive fails, the data is not lost and the database is still functioning properly. When one node is dropped, the other node takes over the load of the failed node and provides the database access service normally
(2) Load balancing: Multiple nodes in the cluster work concurrently to accept the client connection and share the load together.
(3) Scalability: When performance or capacity becomes a bottleneck, we can add new nodes or new disks to the cluster
3, RAC hardware architecture
A. Classification
(1) Plug-in (direct attached Storage, DAS), aka "directly attached storage", " Direct Attach Storage "
storage device is not in the host, the storage is a separate device, it is through the host bus adapter (Adapter, HBA) is connected directly to the host. There is no network device (switch, route, HUB) between the host and the storage device
benefits: Fast, secure, low cost, easy to implement
Cons: Short distances between servers and storage devices, access to storage devices increases server load, server failures, data inaccessible, difficult to scale, and low concentration.
(2) Networking (network attached storage,nas), also known as "networked-attached storage", "Network Attached storage"
storage devices are connected through the network and the host. With the normal network (Ethernet) for data transmission, the existing network can be utilized, so the cost is lower.
(3) network-type (Storage area Network,san) storage Areas Network
Storage devices are also connected through the network and the host. Data transfer with Fibre Channel's proprietary network
advantages: Fast speed, long transmission distance, high reliability, easy to expand. Sans represent the mainstream of storage technology, but at a higher cost
b.raid level
through RAID technology, you can virtual a few physical hard disks into a large hard disk, or n blocks of hard drives.
RAID Technology has two implications: data protection, increased I/O throughput.
C. Introduction to the Network
(1) Public network: Client pass, Web Access to RAC through public network
(2) Private network: Used for mutual communication between node members, that is, node interconnection, only the node can use the private network. cannot be used in public networks to avoid communication delays between nodes, which can affect the performance of RAC.
Note: You should consider the redundancy and high availability of your network, whether it is a public network or a private network.
4. Software Architecture
(1) Software tiering
A. Oracle RAC: is a standalone software (not integrated with the Orae Grid infrastructure), is a database software, but joins the cluster function, responsible for the management of the cluster database.
There is one database in a cluster, one instance on each node, multiple instances accessing the database concurrently, and each instance having its own memory and background processes.
B.orae grid Infrastructure (grid base layer, grid foundation software, cluster Software): is a software, responsible for managing nodes in the cluster, various resources and storage management, is the basis of RAC. Install the GI first and then install the RAC. GI can then be divided into:
A. Oracle clusterware
B. Automated Storage Management ASM (Oracle Automatic Storage Management) for managing shared storage
Oracle 11g integrates Oracle Clusterware with ASM
C. Hardware
(2) Oracle Clusterware software
is a cluster software, called a "cluster Artifact", which consolidates multiple servers into a single cluster, making them a collaborative system.
Key management nodes and various resources, including virtual IP (IP,VIP), Database (Databases), Listener (Listeners), and various services.
Oracle Clusterware Software is a cluster component provided by Oracle Corporation. Third parties also provide similar functionality to software such as IBM's high Availability Cluster multi-processing, HACMP
Principle: Clusterware start, will automatically start a variety of registered resources (such as VIP), and monitor the status of various resources, a quantity of resources failed, Clusterware will automatically restart the failed resources, Clusterware background process runs on each node.
Resources: The appointment of things that are Clusterware managed is called CRS resources. A resource can be a database, instance, listener, VIP, service, or application.
Step: A. Oracle creates resources when Oracle is installed, and we can use the SRVCTL command to manage these Oracle predefined resources
B. After installing Oracle, we can create our own resources. When a resource is started, Oracle reads the configuration information for the resource (which records the various properties of the resource), and the configuration information for the resource is placed in the Oracle Cluster registry (Oracle Cluster Registry, OCR).
C. Resource configuration information is placed in OCR, and OCR must be placed in shared storage (disk display)
Shared storage includes: Data files, SPFILE, Online Redo Log, voting Disks, Control files, OCR
Clusterware Composition: Cluster registry (OCR), voting disk (voting Disks), shared storage, network, background process
(2.1) Cluster registry (Oracle Cluster Registry, OCR)
OCR storage resource configuration, in order to prevent the loss or damage of OCR, should be multi-mirror OCR, put it at the same time in multiple paths (up to 5)
(2.2) Voting plate (voting Disks)
Used to determine which nodes are in the same cluster and must be placed in shared storage, which is shared by multiple nodes. In order to prevent loss or damage to the voting disc, it should also be placed in multiple paths to achieve multiple mirroring, usually at least 3 voting discs should be required.
(2.3) shared storage (software layer)
From the software perspective, how to access shared storage, in the form of:
A.oracle Cluster file system (OCFS)
is officially provided by Oracle. Common file Systems (EXT2, EXT3), first, it is a file system, and secondly, the cluster file system is used to implement multiple servers to share the data stored in the shared storage, which is its greatest feature. The OCFS has the advantages of high performance and availability.
B. Network file System (NFS)
NFS is a distributed File system protocol that allows clients to access data (directories) on another machine over the network, and through NFS, the directory on the remote machine can be mapped to a directory on the machine, and the local machine can access the directory on the remote machine as long as it accesses the local directory.
Server for NFS is typically a file server that provides file sharing services for the entire network.
C. Automated storage Management (ASM)
ASM is a high-performance, easy-to-manage storage solution. ASM manages disks for Oracle, and the Oracle database stores and accesses shared data through ASM.
Oracle is the primary push or automatic storage management (ASM). It is powered by Disk Management, distributing data to multiple disks, rebalancing data, and ultimately achieving high availability and high-performance access to data.
(2.4) Network
A. Public IP address
When installing the Orae Grid infrastructure, you set the public network card address, which is typically used to connect the nodes specified in the cluster from outside, each node has a public IP address
B. Node interconnect (Inter-node communication)----private network
A private network connects the nodes that make up the cluster. Private networks are private and only used for inter-node communication.
Communication protocol: UDP (User Datagram Protocol, subscriber Data Message Protocol), RDS (Reliable Data socket protocol, reliable data socket protocol)
C. Virtual IP (VIP)
A VIP is an IP address that is not bound to a network card in a particular computer computer. Usually a server has a VIP, when the VIP node is down, the VIP can drift from one machine to another machine, continue to provide the external database access services. VIPs are an important part of Oracle's high availability.
The VIP is created when the Orae Grid infrastructure is installed.
There can be more than one VIP in a cluster, that is, multiple access interfaces to the cluster. Cons: When a particular node is removed/incremented from the cluster, we need to reconfigure the client.
D. Unified cluster portal (single Client Access Name, SCAN)
Scan is a hostname that provides a single name (the interface of a single access cluster), which does not have to be a node, but instead corresponds to the entire cluster.
The relationship between the cluster and scan is one by one corresponding. When the client wants to access the cluster, it does not need to specify a VIP, just specify scan.
When changes occur within the cluster (such as deleting a node), there is no impact on scan and no need to reconfigure the client
A scan can correspond to one or more IP addresses (up to 3), for high-availability purposes, a scan should correspond to multiple IP addresses, but can correspond to multiple scan VIPs
Scan Benefits:
Load balancing: When a client requests a database connection, the name of the scan is resolved to an IP address, and each scan is resolved to a different IP address by using the DNS polling scheduling algorithm, and the specified scan listener is connected according to the IP address (scan VIP) client.
The polling scheduling algorithm can also be implemented using Oracle's GNS (Grid naming Service). If you use Gns,oracle to automatically create a scan, if you use DNS resolution, we need to define our own scan
High availability: If scan corresponds to multiple IP addresses, Oracle attempts to use the second IP address in scan when the first IP address is attempted, and so on. If it fails, Oracle returns an error.
(2.5) Background process
Clusterware runs on each node in the cluster, it is divided into two levels, the upper layer is: Cluster ready Services (CRSD), and the lower level is Oracle High Availability Services (OHASD)
Each layer consists of a series of components that are represented as processes or services.
Second, the meaning of RAC----load balancing and failover
1. Load Balancing Classification:
(1) server-side load balancing
(2) Client load Balancing: Scan load balancing, non-scan VIP load balancing, mixed type
2. Load Balancing Example
(1) Non-scan VIP load Balancing
Is the traditional load balancing, need to modify the client's Tnsnames.ora file, and set the Load_balance=on, join the database server VIP (not scan VIP)
When a client requests a connection, a host is randomly selected from the address list to connect.
Such as:
ORCL = (DESCRIPTION =
(load_balance=0n)
(Address= (PROTOCOL=TCP) (host=192.168.0.83) (port=1521))
(Address= (PROTOCOL=TCP) (host=192.168.0.84) (port=1521))
(connect_date=
(SERVICE_NAME=ZERODB)
)
)
Note: load_balance=0n indicates client-side load balancing, ZERODB is the service name, usually the same name as the database
192.168.0.83, 192.168.0.84 is VIP (not scan VIP)
Test that the Tnsnames.ora configuration is correct: sql>tnsping ORCL
After the test Tnsnames.ora succeeds, log in to view the instance of the current session: Sql>select instance_name from v$instance;
Test discovery: Switching between different instances
(2) Scan load Balancer
In this example Myscan corresponds to 3 IP addresses (192.168.0.85, 192.168.0.86, 192.168.0.87)
Modify the client's Tnsnames.ora file
ORCL = (DESCRIPTION =
(Address= (PROTOCOL=TCP) (Host=myscan) (port=1521))
(connect_date=
(SERVICE_NAME=ZERODB)
)
)
Note: Zerodb is the service name, Myscan the name of the scan (in fact, a host name that resolves through DNS), note that host must be the hostname and cannot be an IP address.
Test that the Tnsnames.ora configuration is correct: sql>tnsping ORCL
After the test Tnsnames.ora succeeds, log in to view the instance of the current session: Sql>select instance_name from v$instance;
Test discovery: Switching between different instances
(3) Mixed-load balancing
The hybrid incorporates a common VIP and scan VIP. If you use a hybrid type, you need to modify the parameter Remote_listener
Sql>alter SYSTEM SET remote_listener= ' ... ' Scopte=both sid= ' * ';
If we are using Oracle 11.2, we recommend that you use scan load balancing.
3, server-side load Balancing
when a client chooses a specific IP address to connect to the specified listener, The listener needs to decide which instance to let the client connect to. The listener will let the client connect to the most idle instance, depending on how busy the first instance is.
After you select an instance, if the DB instance is configured as Shared server mode (GKFX server), The listener will let the most idle height process (dispatcher) serve the customer.
server-side load balancing is done automatically by Oracle and requires no DBA intervention.
4. Failure transfer
(1) Classification: Failed transfer on connection (Connet-time Failover), transparent application failed forwarding (Transparent application Failover, TAF)
Connection failure Transfer: When the client connects to the database, it tries to connect to the first listener, and then tries another listener after the failure.
Note: When you configure a network service name, you can set Failover=on to indicate a failover when the account is connected
Transparent application failed forward: is a failover that occurs at run time, such as when a node fails, the session on that node re-establishes the connection.
Oracle 11g Note--rac introduction, meaning