设为首页 收藏本站
查看: 1539|回复: 0

LNMMP架构实现Web动静分离

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-6-15 08:48:02 | 显示全部楼层 |阅读模式
本帖最后由 dfsfsf 于 2015-6-15 08:50 编辑

前言

前面的文章中说过LAMP架构包括:Linux操作系统,Apache网站服务器,MySQL数据库,Perl、PHP或者Python编程语言,而今天要说的LNMMP 和LAMP类似,只是作为Web服务器的不再是Apache而是高性能的Nginx,同时引进Memcached加速缓存效率,用于加快访问速度。

Memcached是一款开源、高性能、分布式内存对象缓存系统,可应用各种需要缓存的场景,其主要目的是通过降低对数据库的访问来加速Web应用程序。它是一个基于内存的“键值对”存储,用于存储数据库调用、API调用或页面引用结果的直接数据,如字符串、对象等。

实现过程

实验拓扑

QQ截图20150615085055.png

实验环境

系统环境:CentOS6.6

web服务器:172.16.10.123 nginx-1.6.3

PHP服务器:172.16.10.110 php-5.4.26

数据库服务器:172.16.10.211 MariaDB-5.5.36

Memcached服务器:172.16.10.212 memcached-1.4.24

工作原理

利用nginx的高性能特点做前端反向代理服务器,分发用户请求,静态请求直接返回结果,动态请求交给后端php处理,php查询数据库返回处理结果,并将结果缓存至Memcached,当接收新请求时,php首先在Memcached查询,Memcached有结果直接返还给nginx,没结果再查询数据库,依次类推。

安装配置nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#解决依赖关系
[iyunv@node1 ~]# yum groupinstall "Development Tools" "Server Platform Deveopment" -y
[iyunv@node1 ~]# yum install openssl-devel pcre-devel -y
[iyunv@node1 ~]# groupadd -r nginx
[iyunv@node1 ~]# useradd -r -g nginx nginx
[iyunv@node1 ~]# tar xf nginx-1.6.3.tar.gz
[iyunv@node1 ~]# cd nginx-1.6.3
[iyunv@node1 ~]# [iyunv@node1 ~]# cd nginx-1.6.3
[iyunv@node1 nginx-1.6.3]# ./configure \
>   --prefix=/usr/local/nginx \
>   --sbin-path=/usr/sbin/nginx \
>   --conf-path=/etc/nginx/nginx.conf \
>   --error-log-path=/var/log/nginx/error.log \
>   --http-log-path=/var/log/nginx/access.log \
>   --pid-path=/var/run/nginx/nginx.pid  \
>   --lock-path=/var/lock/nginx.lock \
>   --user=nginx \
>   --group=nginx \
>   --with-http_ssl_module \
>   --with-http_flv_module \
>   --with-http_stub_status_module \
>   --with-http_gzip_static_module \
>   --http-client-body-temp-path=/usr/local/nginx/client/ \
>   --http-proxy-temp-path=/usr/local/nginx/proxy/ \
>   --http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \
>   --http-uwsgi-temp-path=/usr/local/nginx/uwsgi \
>   --http-scgi-temp-path=/usr/local/nginx/scgi \
>   --with-pcre
[iyunv@node1 nginx-1.6.3]# make && make install



为nginx提供SysV init脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
[iyunv@node1 ~]# vim /etc/rc.d/init.d/nginx
#新建文件/etc/rc.d/init.d/nginx,内容如下:
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig:   - 85 15
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
#               proxy and IMAP/POP3 proxy server
# processname: nginx
# config:      /etc/nginx/nginx.conf
# config:      /etc/sysconfig/nginx
# pidfile:     /var/run/nginx.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/etc/nginx/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {
   # make required directories
   user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
   options=`$nginx -V 2>&1 | grep 'configure arguments:'`
   for opt in $options; do
       if [ `echo $opt | grep '.*-temp-path'` ]; then
           value=`echo $opt | cut -d "=" -f 2`
           if [ ! -d "$value" ]; then
               # echo "creating" $value
               mkdir -p $value && chown -R $user $value
           fi
       fi
   done
}

start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    make_dirs
    echo -n $"Starting $prog: "
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    configtest || return $?
    stop
    sleep 1
    start
}

reload() {
    configtest || return $?
    echo -n $"Reloading $prog: "
    killproc $nginx -HUP
    RETVAL=$?
    echo
}

force_reload() {
    restart
}

configtest() {
  $nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
    status $prog
}

rh_status_q() {
    rh_status >/dev/null 2>&1
}

case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart|configtest)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
            ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-
reload|configtest}"
        exit 2
esac



为脚本赋予执行权限

1
[iyunv@node1 ~]# chmod +x /etc/rc.d/init.d/nginx



添加至服务管理列表,并让其开机自动启动

1
2
[iyunv@node1 ~]# chkconfig --add nginx
[iyunv@node1 ~]# chkconfig nginx on



配置nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[iyunv@node1 ~]# vim /etc/nginx/nginx.conf

worker_processes  2;      #worker进程的个数
error_log  /var/log/nginx/error.log  notice;     #错误日志路径及级别
events {
    worker_connections  1024;    #每个worker能够并发响应的最大请求数
}
http {
    include       mime.types;    #支持多媒体类型
    default_type  application/octet-stream;
    sendfile        on;    #由内核直接转发
    #keepalive_timeout  0;
    keepalive_timeout  5;    #持久连接5s
    gzip  on;    #开启压缩功能
    server {
        listen       80;
        server_name  bbs.scholar.com;
        add_header X-via $server_addr;    #让客户端能够看到代理服务器的IP
        location / {
            root   /www/bbs;
            index  index.php index.html index.htm;
        }
        location ~* \.(jpg|jpeg|png|gif|js|css)$ {  #匹配静态内容
            root   /www/bbs;   
        }
        location ~ \.php$ {  #匹配动态内容
            root                /www/bbs;
            fastcgi_pass        172.16.10.110:9000;    #代理到的服务器
            fastcgi_index       index.php;
            fastcgi_param       SCRIPT_FILENAME scripts$fastcgi_script_name;
            include             fastcgi_params;
        }
    }  
}

[iyunv@node1 ~]# vim /etc/nginx/fastcgi_params

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

[iyunv@node1 ~]# service nginx start



安装配置memcached

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#解决依赖关系
[iyunv@scholar ~]# yum groupinstall "Development Tools" "Server Platform Deveopment" -y
#安装libevent
#memcached依赖于libevent API,因此要事先安装之
[iyunv@scholar ~]# tar xf libevent-2.0.22-stable.tar.gz
[iyunv@scholar ~]# cd libevent-2.0.22-stable
[iyunv@scholar libevent-2.0.22-stable]#  ./configure --prefix=/usr/local/libevent
[iyunv@scholar libevent-2.0.22-stable]# make && make install
[iyunv@scholar ~]# echo "/usr/local/libevent/lib" > /etc/ld.so.conf.d/libevent.conf
[iyunv@scholar ~]# ldconfig
#安装配置memcached
[iyunv@scholar ~]# tar xf memcached-1.4.24.tar.tar
[iyunv@scholar ~]# cd memcached-1.4.24
[iyunv@scholar memcached-1.4.24]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[iyunv@scholar memcached-1.4.24]# make && make install



提供脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
[iyunv@scholar ~]# vim /etc/init.d/memcached

#!/bin/bash
#
# Init file for memcached
#
# chkconfig: - 86 14
# description: Distributed memory caching daemon
#
# processname: memcached
# config: /etc/sysconfig/memcached

. /etc/rc.d/init.d/functions

## Default variables
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

RETVAL=0
prog="/usr/local/memcached/bin/memcached"
desc="Distributed memory caching"
lockfile="/var/lock/subsys/memcached"

start() {
        echo -n $"Starting $desc (memcached): "
        daemon $prog -d -p $PORT -u $USER -c $MAXCONN -m $CACHESIZE -o "$OPTIONS"
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success && touch $lockfile || failure
        echo
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $desc (memcached): "
        killproc $prog
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success && rm -f $lockfile || failure
        echo
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading $desc ($prog): "
        killproc $prog -HUP
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        [ -e $lockfile ] && restart
        RETVAL=$?
        ;;      
  reload)
        reload
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
   *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        RETVAL=1
esac

exit $RETVAL



授权并启动服务

1
2
3
4
[iyunv@scholar ~]# vim /etc/init.d/memcached
[iyunv@scholar ~]# chmod +x /etc/init.d/memcached
[iyunv@scholar ~]# chkconfig --add memcached
[iyunv@scholar ~]# service memcached start



安装配置php

1
2
3
4
5
6
7
8
9
10
11
12
#解决依赖关系
[iyunv@scholar ~]#  yum groupinstall "Development tools" "Server Platform Development" -y
[iyunv@scholar ~]#  yum -y groupinstall "Desktop Platform Development"
[iyunv@scholar ~]#  yum -y install bzip2-devel libmcrypt-devel
[iyunv@scholar ~]# tar xf php-5.4.26.tar.bz2
[iyunv@scholar ~]# cd php-5.4.26
[iyunv@scholar php-5.4.26]#  ./configure --prefix=/usr/local/php --with-mysql=mysqlnd
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-mbstring --with-freetype-dir
--with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  
--enable-sockets --enable-fpm --with-mcrypt  --with-config-file-path=/etc
--with-config-file-scan-dir=/etc/php.d --with-bz2 --with-openssl
[iyunv@scholar php-5.4.26]# make && make install



提供配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#为php提供配置文件
[iyunv@scholar php-5.4.26]# cp php.ini-production /etc/php.ini
#为php-fpm提供脚本
[iyunv@scholar php-5.4.26]# cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm
[iyunv@scholar php-5.4.26]# chmod +x /etc/rc.d/init.d/php-fpm
[iyunv@scholar php-5.4.26]# chkconfig --add php-fpm
[iyunv@scholar php-5.4.26]# chkconfig php-fpm on
#为php-fpm提供配置文件
[iyunv@scholar php-5.4.26]# cd /usr/local/php
[iyunv@scholar php]# cp etc/php-fpm.conf.default etc/php-fpm.conf
[iyunv@scholar php]# vim etc/php-fpm.conf  

pid =/usr/local/php/var/run/php-fpm.pid

listen = 172.16.10.110:9000

pm.max_children = 25  #最大子进程数

pm.start_servers = 5  #开机预启动子进程数

pm.min_spare_servers = 2 #最小空闲子进程数

pm.max_spare_servers = 6 #最大空闲子进程数



php安装xcache拓展

1
2
3
4
5
6
7
8
9
10
11
12
13
[iyunv@scholar ~]# tar xf xcache-3.1.0.tar.bz2
[iyunv@scholar ~]# cd xcache-3.1.0
[iyunv@scholar xcache-3.1.0]# /usr/local/php/bin/phpize
[iyunv@scholar xcache-3.1.0]# ./configure --enable-xcache --with-php-config=/usr/local/php
/bin/php-config
[iyunv@scholar xcache-3.1.0]# make && make install
[iyunv@scholar xcache-3.1.0]# mkdir /etc/php.d
[iyunv@scholar xcache-3.1.0]# cp xcache.ini /etc/php.d/
[iyunv@scholar xcache-3.1.0]# vim /etc/php.d/xcache.ini

[xcache-common]
;; non-Windows example:
extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so



php安装memcache拓展

1
2
3
4
5
6
7
8
9
10
[iyunv@scholar ~]# tar xf memcache-2.2.7.tgz
[iyunv@scholar ~]# cd memcache-2.2.7
[iyunv@scholar memcache-2.2.7]# /usr/local/php/bin/phpize
[iyunv@scholar memcache-2.2.7]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache
[iyunv@scholar memcache-2.2.7]# make && make install
[iyunv@scholar memcache-2.2.7]# vim /etc/php.ini

extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so

[iyunv@scholar ~]# service php-fpm start



安装配置mariadb

1
2
3
4
5
6
7
8
[iyunv@MariaDB ~]# mkdir /mydata/data -pv
[iyunv@MariaDB ~]# groupadd -r mysql
[iyunv@MariaDB ~]# useradd -g mysql -r mysql
[iyunv@MariaDB ~]# chown -R mysql.mysql /mydata/data
[iyunv@MariaDB ~]# tar xf mariadb-5.5.36-linux-x86_64.tar.gz -C /usr/local
[iyunv@MariaDB ~]# cd /usr/local
[iyunv@MariaDB local]# ln -sv mariadb-5.5.36-linux-x86_64 mysql
[iyunv@MariaDB local]# chown -R root.mysql mysql



提供配置及脚本文件

1
2
3
4
5
6
7
8
9
10
11
[iyunv@MariaDB local]# mkdir /etc/mysql
[iyunv@MariaDB local]# cd mysql
[iyunv@MariaDB mysql]# cp /support-files/my-large.cnf /etc/mysql/my.cnf
[iyunv@MariaDB mysql]# vim /etc/mysql/my.cnf

datadir = /mydata/data  

[iyunv@MariaDB mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[iyunv@MariaDB mysql]# chmod +x /etc/rc.d/init.d/mysqld
[iyunv@MariaDB mysql]# chkconfig --add mysqld
[iyunv@MariaDB mysql]# chkconfig mysqld on



初始化数据库

1
2
[iyunv@MariaDB mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data
[iyunv@MariaDB ~]# service mysqld start



部署站点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[iyunv@node1 ~]# mkdir /www/bbs -pv
[iyunv@node1 ~]# unzip wordpress-3.2.1-zh_CN.zip
[iyunv@node1 ~]# cd wordpress
[iyunv@node1 wordpress]# mv * /www/bbs/

#在web和php上分别准备站点文件
#php节点
[iyunv@scholar ~]# cd /www/bbs
[iyunv@scholar bbs]# cp wp-config-sample.php wp-config.php
[iyunv@scholar bbs]# vim wp-config.php

/** WordPress 数据库的名称 */
define('DB_NAME', 'wpdb');

/** MySQL 数据库用户名 */
define('DB_USER', 'wpuser');

/** MySQL 数据库密码 */
define('DB_PASSWORD', 'wppass');

/** MySQL 主机 */
define('DB_HOST', '172.16.10.211');

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');



创建数据库并授权

1
2
3
4
5
6
7
8
MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.05 sec)

MariaDB [(none)]> grant all on wpdb.* to wpuser@'172.16.%.%' identified by 'wppass';
Query OK, 0 rows affected (0.06 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.03 sec)



wKioL1V9g3jzecggAAH7-nrGDs0387.jpg

wKiom1V9gePCk36PAALwHqy4QyY722.jpg

安装memadmin

MemAdmin是一款可视化的Memcached管理与监控工具,使用PHP开发,体积小,操作简单。

主要功能:

1
2
3
4
5
6
7
服务器参数监控:STATS、SETTINGS、ITEMS、SLABS、SIZES实时刷新
服务器性能监控:GET、DELETE、INCR、DECR、CAS等常用操作命中率实时监控
支持数据遍历,方便对存储内容进行监视
支持条件查询,筛选出满足条件的KEY或VALUE
数组、JSON等序列化字符反序列显示
兼容memcache协议的其他服务,如Tokyo Tyrant (遍历功能除外)
支持服务器连接池,多服务器管理切换方便简洁



1
2
3
[iyunv@node1 ~]# tar xf memadmin-1.0.12.tar.gz -C /www/bbs/

#web和php端都需执行此操作



登陆后添加服务器

wKioL1V9ibrhVeI6AAHxb0pJCFM908.jpg

开始管理服务器

wKioL1V9ihrAVJ1lAALig6LPZjk788.jpg

wKioL1V9ii3RiFDMAAO7jmuPeTk682.jpg

更多细节有兴趣可自行探索

Ten end

LNMMP架构实现Web动静分离实验就说到这里了,整个部署过程跟LAMP类似,朋友们部署过程遇到问题可留言交流,nginx在反向代理时还可将缓存缓存至memcached服务器,从而提高缓存性能,这里稍微一提,就不做详解了。以上仅为个人学习整理,如有错漏,大神勿喷~~~



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-77308-1-1.html 上篇帖子: Windows环境WampServer Version 2.5配置虚拟主机日记 下篇帖子: LAMP搭建完整总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表