当前位置: 首页 > news >正文

hue 4.11容器化部署,已结合Hive与Hadoop

配合《Hue 部署过程中的报错处理》食用更佳

官方配置说明页面:
https://docs.gethue.com/administrator/configuration/connectors/
官方配置hue.ini页面
https://github.com/cloudera/hue/blob/master/desktop/conf.dist/hue.ini

docker部署

注意

  • 初次部署需要先注释hue.ini配置文件的映射,待到部署成功后,将配置文件拷贝到指定目录后,再取消注释进行部署即可。
    或者到该地址下去复制并新建hue.ini,放到/data/hue/目录下(推荐)。https://github.com/cloudera/hue/blob/master/desktop/conf.dist/hue.ini
  • 如果已部署hive与hadoop,最好部署hue容器之前将文件映射配置修改完整
  • 如果未部署hive与Hadoop,忽略即可,后续有需要时再回来修改配置并重新部署hue容器即可
version: '3.3'  # 指定Docker Compose的版本
services:  # 定义服务列表hue:  # 服务的名称image: gethue/hue:4.11.0  # 指定使用的镜像及其版本container_name: hue  # 设置容器的名称restart: always  # 配置容器的重启策略为总是重启privileged: true  # 给予容器特权模式,拥有更多权限hostname: hue  # 设置容器的主机名ports:  # 端口映射- "9898:8888"  # 将容器的8888端口映射到宿主机的9898端口environment:  # 环境变量设置- TZ=Asia/Shanghai  # 设置时区为中国上海volumes:  # 数据卷配置- /data/hue/hue.ini:/usr/share/hue/desktop/conf/hue.ini  # 将宿主机的hue.ini配置文件映射到容器内的指定位置- /etc/localtime:/etc/localtime  # 将宿主机的本地时间设置映射到容器内,确保容器与宿主机时间一致- /opt/hive-3.1.3:/opt/hive-3.1.3 # 将宿主机的hive目录映射到容器内- /opt/hadoop-3.3.0:/opt/hadoop-3.3.0 # 将宿主机的hadoop目录映射到容器内networks:hue_default:ipv4_address: 172.15.0.2  # 指定静态IP地址networks:  # 定义网络hue_default:driver: bridge  # 使用bridge驱动ipam:config:- subnet: 172.15.0.0/16  # 指定子网范围
# 1. 创建hue部署文件
vi docker-compose-hue.yml# 2. 将上方的部署内容复制粘贴到docker-compose-hue.yml中
# 3. 使用docker compose部署hue
docker compose -f docker-compose-hue.yml  up -d# 4. 检验是否部署成功,同一局域网下的浏览器访问hue
# 由于这是您第一次登录,请选择任意用户名和密码。请务必记住这些,因为它们将成为您的 Hue 超级用户凭据。
主机ip:9898

hue初始化

  1. hue.ini 配置文件修改
vi /data/hue/hue.ini
# 修改Webserver监听地址http_host=127.0.0.1# 修改时区time_zone=Asia/Shanghai# 配置hue元数据数据库存储
[[database]]engine=mysqlhost=192.168.10.75port=3306user=rootpassword=HoMf@123name=hue# 配置hue数据库连接,用于查询Mysql数据库
[[interpreters]]
# Define the name and how to connect and execute the language.
# https://docs.gethue.com/administrator/configuration/editor/[[[mysql]]]name = MySQLinterface=sqlalchemy
#   ## https://docs.sqlalchemy.org/en/latest/dialects/mysql.htmloptions='{"url": "mysql://root:HoMf@123@192.168.10.75:3306/hue_meta"}'
#   ## options='{"url": "mysql://${USER}:${PASSWORD}@localhost:3306/hue"}'
  1. 创建数据库
# 进入数据库
mysql -uroot -pHoMf@123# 创建hue数据库
mysql> create database `hue` default character set utf8mb4 default collate utf8mb4_general_ci;
Query OK, 1 row affected (0.00 sec)# 创建hue_meta数据库
mysql> create database `hue_meta` default character set utf8mb4 default collate utf8mb4_general_ci;
Query OK, 1 row affected (0.00 sec)
  1. 应用配置文件,重启容器,进入容器,数据库初始化
# 重启hue容器
docker restart hue# 进入hue容器
docker exec -it hue bash# 执行数据库初始化
/usr/share/hue/build/env/bin/hue syncdb
/usr/share/hue/build/env/bin/hue migrate# 退出容器,ctrl + D,或
exit
  • 数据库初始化详细操作及返回结果
hue@hue:/usr/share/hue$ /usr/share/hue/build/env/bin/hue syncdb
[22/Nov/2024 15:38:07 +0800] settings     INFO     Welcome to Hue 4.11.0
[22/Nov/2024 15:38:08 +0800] conf         WARNING  enable_extract_uploaded_archive is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:08 +0800] conf         WARNING  enable_new_create_table is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:08 +0800] conf         WARNING  force_hs2_metadata is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:08 +0800] conf         WARNING  show_table_erd is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[21/Nov/2024 23:38:08 -0800] backend      WARNING  mozilla_django_oidc module not found
[21/Nov/2024 23:38:09 -0800] apps         INFO     AXES: BEGIN LOG
[21/Nov/2024 23:38:09 -0800] apps         INFO     AXES: Using django-axes version 5.13.0
[21/Nov/2024 23:38:09 -0800] apps         INFO     AXES: blocking by IP only.
[21/Nov/2024 23:38:09 -0800] api3         WARNING  simple_salesforce module not found
[21/Nov/2024 23:38:09 -0800] jdbc         WARNING  Failed to import py4j
[21/Nov/2024 23:38:10 -0800] schemas      INFO     Resource 'XMLSchema.xsd' is already loaded
No changes detected
hue@hue:/usr/share/hue$ /usr/share/hue/build/env/bin/hue migrate
[22/Nov/2024 15:38:33 +0800] settings     INFO     Welcome to Hue 4.11.0
[22/Nov/2024 15:38:33 +0800] conf         WARNING  enable_extract_uploaded_archive is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:33 +0800] conf         WARNING  enable_new_create_table is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:33 +0800] conf         WARNING  force_hs2_metadata is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[22/Nov/2024 15:38:33 +0800] conf         WARNING  show_table_erd is of type bool. Resetting it as type 'coerce_bool'. Please fix it permanently
[21/Nov/2024 23:38:33 -0800] backend      WARNING  mozilla_django_oidc module not found
[21/Nov/2024 23:38:34 -0800] apps         INFO     AXES: BEGIN LOG
[21/Nov/2024 23:38:34 -0800] apps         INFO     AXES: Using django-axes version 5.13.0
[21/Nov/2024 23:38:34 -0800] apps         INFO     AXES: blocking by IP only.
[21/Nov/2024 23:38:34 -0800] api3         WARNING  simple_salesforce module not found
[21/Nov/2024 23:38:34 -0800] jdbc         WARNING  Failed to import py4j
[21/Nov/2024 23:38:35 -0800] schemas      INFO     Resource 'XMLSchema.xsd' is already loaded
Operations to perform:Apply all migrations: auth, authtoken, axes, beeswax, contenttypes, desktop, jobsub, oozie, pig, sessions, sites, useradmin
Running migrations:Applying contenttypes.0001_initial... OKApplying contenttypes.0002_remove_content_type_name... OKApplying auth.0001_initial... OKApplying auth.0002_alter_permission_name_max_length... OKApplying auth.0003_alter_user_email_max_length... OKApplying auth.0004_alter_user_username_opts... OKApplying auth.0005_alter_user_last_login_null... OKApplying auth.0006_require_contenttypes_0002... OKApplying auth.0007_alter_validators_add_error_messages... OKApplying auth.0008_alter_user_username_max_length... OKApplying auth.0009_alter_user_last_name_max_length... OKApplying auth.0010_alter_group_name_max_length... OKApplying auth.0011_update_proxy_permissions... OKApplying auth.0012_alter_user_first_name_max_length... OKApplying authtoken.0001_initial... OKApplying authtoken.0002_auto_20160226_1747... OKApplying authtoken.0003_tokenproxy... OKApplying axes.0001_initial... OKApplying axes.0002_auto_20151217_2044... OKApplying axes.0003_auto_20160322_0929... OKApplying axes.0004_auto_20181024_1538... OKApplying axes.0005_remove_accessattempt_trusted... OKApplying axes.0006_remove_accesslog_trusted... OKApplying axes.0007_add_accesslog_trusted... OKApplying axes.0008_remove_accesslog_trusted... OKApplying beeswax.0001_initial... OKApplying beeswax.0002_auto_20200320_0746... OKApplying beeswax.0003_compute_namespace... OKApplying desktop.0001_initial... OKApplying desktop.0002_initial... OKApplying desktop.0003_initial... OKApplying desktop.0004_initial... OKApplying desktop.0005_initial... OKApplying desktop.0006_initial... OKApplying desktop.0007_initial... OKApplying desktop.0008_auto_20191031_0704... OKApplying desktop.0009_auto_20191202_1056... OKApplying desktop.0010_auto_20200115_0908... OKApplying desktop.0011_document2_connector... OKApplying desktop.0012_connector_interface... OKApplying desktop.0013_alter_document2_is_trashed... OKApplying jobsub.0001_initial... OKApplying oozie.0001_initial... OKApplying oozie.0002_initial... OKApplying oozie.0003_initial... OKApplying oozie.0004_initial... OKApplying oozie.0005_initial... OKApplying oozie.0006_auto_20200714_1204... OKApplying oozie.0007_auto_20210126_2113... OKApplying oozie.0008_auto_20210216_0216... OKApplying pig.0001_initial... OKApplying pig.0002_auto_20200714_1204... OKApplying sessions.0001_initial... OKApplying sites.0001_initial... OKApplying sites.0002_alter_domain_unique... OKApplying useradmin.0001_initial... OKApplying useradmin.0002_userprofile_json_data... OKApplying useradmin.0003_auto_20200203_0802... OKApplying useradmin.0004_userprofile_hostname... OK
[21/Nov/2024 23:38:42 -0800] models       INFO     HuePermissions: 34 added, 0 updated, 0 up to date, 0 stale, 0 deleted
  1. 查看数据库表是否创建成功,判断数据库是否初始化完成
# 进入数据库
mysql -uroot -pHoMf@123# 进入hue数据库
mysql> use hue;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed# 查看hue数据库内的数据库表
mysql> show tables;
+--------------------------------+
| Tables_in_hue                  |
+--------------------------------+
| auth_group                     |
| auth_group_permissions         |
| auth_permission                |
| auth_user                      |
| auth_user_groups               |
| auth_user_user_permissions     |
| authtoken_token                |
| axes_accessattempt             |
| axes_accesslog                 |
| beeswax_compute                |
| beeswax_metainstall            |
| beeswax_namespace              |
| beeswax_queryhistory           |
| beeswax_savedquery             |
| beeswax_session                |
| defaultconfiguration_groups    |
| desktop_connector              |
| desktop_defaultconfiguration   |
| desktop_document               |
| desktop_document2              |
| desktop_document2_dependencies |
| desktop_document2permission    |
| desktop_document_tags          |
| desktop_documentpermission     |
| desktop_documenttag            |
| desktop_settings               |
| desktop_userpreferences        |
| django_content_type            |
| django_migrations              |
| django_session                 |
| django_site                    |
| documentpermission2_groups     |
| documentpermission2_users      |
| documentpermission_groups      |
| documentpermission_users       |
| jobsub_checkforsetup           |
| jobsub_jobdesign               |
| jobsub_jobhistory              |
| jobsub_oozieaction             |
| jobsub_ooziedesign             |
| jobsub_ooziejavaaction         |
| jobsub_ooziemapreduceaction    |
| jobsub_ooziestreamingaction    |
| oozie_bundle                   |
| oozie_bundledcoordinator       |
| oozie_coordinator              |
| oozie_datainput                |
| oozie_dataoutput               |
| oozie_dataset                  |
| oozie_decision                 |
| oozie_decisionend              |
| oozie_distcp                   |
| oozie_email                    |
| oozie_end                      |
| oozie_fork                     |
| oozie_fs                       |
| oozie_generic                  |
| oozie_history                  |
| oozie_hive                     |
| oozie_java                     |
| oozie_job                      |
| oozie_join                     |
| oozie_kill                     |
| oozie_link                     |
| oozie_mapreduce                |
| oozie_node                     |
| oozie_pig                      |
| oozie_shell                    |
| oozie_sqoop                    |
| oozie_ssh                      |
| oozie_start                    |
| oozie_streaming                |
| oozie_subworkflow              |
| oozie_workflow                 |
| pig_document                   |
| pig_pigscript                  |
| useradmin_grouppermission      |
| useradmin_huepermission        |
| useradmin_ldapgroup            |
| useradmin_userprofile          |
+--------------------------------+
80 rows in set (0.01 sec)

部署检验

此时应可以正常进入hue界面,并且Sources列表内能够看到MySql
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

配置hive

请先添加好文件映射,确保在容器内也可以访问到hive的配置文件目录
修改hue.ini配置文件,修改后重启容器即可
配置成功后即可在hue界面内的Sources列表内能够看到Hive
在这里插入图片描述

# 修改hue配置文件
vi /data/hue/hue.ini
# 取消注释即可[[[hive]]]name=Hiveinterface=hiveserver2[beeswax]# Host where HiveServer2 is running.
# If Kerberos security is enabled, use fully-qualified domain name (FQDN).
# hive主机地址hive_server_host=192.168.10.75# Binary thrift port for HiveServer2.
# hive-site.xml中的hive.server2.thrift.port配置hive_server_port=10000# Hive configuration directory, where hive-site.xml is located# hive配置文件目录,若为容器部署,则需要配置文件映射hive_conf_dir=/opt/hive-3.1.3/conf# Timeout in seconds for thrift calls to Hive serviceserver_conn_timeout=120# Override the default desktop username and password of the hue user used for authentications with other services.
# e.g. Used for LDAP/PAM pass-through authentication.auth_username=hueauth_password=root[metastore]
# Flag to turn on the new version of the create table wizard.enable_new_create_table=true
  • 附上我的hive-site.xml配置
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
-->
<configuration><property><name>hive.metastore.warehouse.dir</name><value>/user/hive-3.1.3/warehouse</value><description/></property><property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:mysql://Linux-Master:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false&amp;allowPublicKeyRetrieval=true</value><description>数据库连接</description></property><property><name>javax.jdo.option.ConnectionDriverName</name><value>com.mysql.jdbc.Driver</value><description/></property><property><name>javax.jdo.option.ConnectionUserName</name><value>root</value><description/></property><property><name>javax.jdo.option.ConnectionPassword</name><value>HoMf@123</value><description/></property><property><name>hive.querylog.location</name><value>/home/hadoop/logs/hive-3.1.3/job-logs/${user.name}</value><description>Location of Hive run time structured log file</description></property><property><name>hive.exec.scratchdir</name><value>/user/hive-3.1.3/tmp</value></property><property><name>hive.server2.thrift.port</name><value>11000</value></property>
</configuration>

配置 Hadoop

配置 HDFS

修改hue.ini

# 修改hue配置文件
vi /data/hue/hue.ini
# hdfs集群配置
[[hdfs_clusters]]# HA support by using HttpFs[[[default]]]fs_defaultfs=hdfs://192.168.10.75:9000webhdfs_url=http://192.168.10.75:9870/webhdfs/v1hadoop_conf_dir=/opt/hadoop-3.3.0/etc/hadoop# yarn集群配置
[[yarn_clusters]][[[default]]]
# Enter the host on which you are running the ResourceManagerresourcemanager_host=192.168.10.75# The port where the ResourceManager IPC listens onresourcemanager_port=8032# Whether to submit jobs to this cluster
submit_to=True# Resource Manager logical name (required for HA)
## logical_name=# Change this if your YARN cluster is Kerberos-secured
## security_enabled=false# URL of the ResourceManager APIresourcemanager_api_url=http://192.168.10.75:8088# URL of the ProxyServer APIproxy_api_url=http://192.168.10.75:8088# URL of the HistoryServer APIhistory_server_api_url=http://localhost:19888

修改hadoop的core-site.xml

<!—允许通过 httpfs 方式访问 hdfs 的主机名 -->
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
</property>
<!—允许通过 httpfs 方式访问 hdfs 的用户组 -->
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
  • 这里附上我的core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><property><name>hadoop.tmp.dir</name><value>/opt/hadoop-3.3.0/tmp</value><description>Abase for other temporary directories.</description></property><property><name>fs.defaultFS</name><!-- IP地址为主节点服务器地址 --><value>hdfs://192.168.10.75:9000</value></property><property><name>hadoop.proxyuser.root.hosts</name><value>*</value></property><property><name>hadoop.proxyuser.root.groups</name><value>*</value></property><property><name>hadoop.proxyuser.hue.hosts</name><value>*</value></property><property><name>hadoop.proxyuser.hue.groups</name><value>*</value></property>
</configuration>

修改hadoop的hdfs-site.xml

<property><name>dfs.webhdfs.enabled</name><value>true</value>
</property>
  • 这里附上我的hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><!-- nn web 端访问地址--><property><name>dfs.namenode.http-address</name><!-- master-ubuntu需要改为主节点机器名--><value>linux-master:9870</value></property><!-- 2nn web 端访问地址--><property><name>dfs.namenode.secondary.http-address</name><!-- slave1-ubuntu需要改为第一从节点台机器名--><value>linux-slave01:9868</value></property><property><name>dfs.permissions.enabled</name><value>false</value></property><property><name>dfs.webhdfs.enable</name><value>true</value></property>
</configuration>

配置yarn集群

  • 配置hadoop的yarn-site.xml
        <!-- 开启日志聚集功能 --><property><name>yarn.log-aggregation-enable</name><value>true</value></property><!-- 设置日志聚集服务器地址 --><property><name>yarn.log.server.url</name><!-- IP地址为主节点机器地址 --><value>http://192.168.10.75:19888/jobhistory/logs</value></property><!-- 设置日志保留时间为 7 天 --><property><name>yarn.log-aggregation.retain-seconds</name><value>604800</value></property>
  • 这里附上我的yarn-site.xml
<?xml version="1.0"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
-->
<configuration><!-- Site specific YARN configuration properties --><!-- 指定 MR 走 shuffle --><property><name>yarn.nodemanager.aux-services</name><value>mapreduce_shuffle</value></property><!-- 指定 ResourceManager 的地址--><property><name>yarn.resourcemanager.hostname</name><!-- master-ubuntu需要改为为主节点机器名--><value>linux-master</value></property><!-- 环境变量的继承 --><property><name>yarn.nodemanager.env-whitelist</name><value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CO NF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value></property><!-- 开启日志聚集功能 --><property><name>yarn.log-aggregation-enable</name><value>true</value></property><!-- 设置日志聚集服务器地址 --><property><name>yarn.log.server.url</name><!-- IP地址为主节点机器地址 --><value>http://192.168.10.75:19888/jobhistory/logs</value></property><!-- 设置日志保留时间为 7 天 --><property><name>yarn.log-aggregation.retain-seconds</name><value>604800</value></property>
</configuration>

相关文章:

hue 4.11容器化部署,已结合Hive与Hadoop

配合《Hue 部署过程中的报错处理》食用更佳 官方配置说明页面&#xff1a; https://docs.gethue.com/administrator/configuration/connectors/ 官方配置hue.ini页面 https://github.com/cloudera/hue/blob/master/desktop/conf.dist/hue.ini docker部署 注意&#xff1a; …...

“软件定义汽车”时代 | 产线海量数据刷写解决方案

一 背景 从起初汽车概念问世时期的“机械定义汽车”&#xff0c;到电力出现后的“电器定义汽车”&#xff0c;再到电子科技迅猛发展后的“电子定义汽车”&#xff0c;再到如今的“软件定义汽车”&#xff0c;可以看出&#xff0c;软件在车辆中扮演着越来越重要的角色。与此同时…...

DDoS对策是什么?详细解读DDoS攻击难以防御的原因与解决方案

近年来&#xff0c;DDoS&#xff08;分布式拒绝服务&#xff09;攻击的规模和频率不断增加。根据数据显示&#xff0c;2023年已观测到的最大攻击流量达到700Gbps&#xff0c;远远超出了许多企业的防御能力。DDoS攻击导致的网站性能问题如页面加载缓慢、频繁的504错误等现象&…...

【AI系统】Tensor Core 架构演进

自 Volta 架构时代起&#xff0c;英伟达的 GPU 架构已经明显地转向深度学习领域的优化和创新。2017 年&#xff0c;Volta 架构横空出世&#xff0c;其中引入的张量核心&#xff08;Tensor Core&#xff09;设计可谓划时代之作&#xff0c;这一设计专门针对深度学习计算进行了优…...

React前端框架基础知识详解

React 是由 Facebook 推出的一个用于构建用户界面的 JavaScript 库&#xff0c;现已成为前端开发中最流行的框架之一。React 的核心理念是通过组件化的方式构建用户界面&#xff0c;提升代码的可维护性和复用性。本文将为大家详细介绍 React 框架的基础知识&#xff0c;并带你快…...

Python学习——猜拳小游戏

import random player int(input(“请输入&#xff1a;剪刀 0&#xff0c;石头 1&#xff0c;布2”)) computer random.randint(0,2)# print(“玩家输入的是%d&#xff0c;电脑输入的是%d” %(player,computer)) 用于测试 if (player 0) and (computer 0) or (player 1) a…...

Spring:AOP通知类型

我们先来回顾下AOP通知: AOP通知描述了抽取的共性功能&#xff0c;根据共性功能抽取的位置不同&#xff0c;最终运行代码时要将其加入到合理的位置 通知具体要添加到切入点的哪里? 共提供了5种通知类型: 前置通知后置通知环绕通知(重点)返回后通知(了解)抛出异常后通知(了…...

【公益接口】不定时新增接口,仅供学习

文章日期&#xff1a;2024.11.24 使用工具&#xff1a;Python 文章类型&#xff1a;公益接口 文章全程已做去敏处理&#xff01;&#xff01;&#xff01; 【需要做的可联系我】 AES解密处理&#xff08;直接解密即可&#xff09;&#xff08;crypto-js.js 标准算法&#xff…...

php 导出excel 一个单元格 多张图片

public function dumpData(){error_reporting(0); // 禁止错误信息输出ini_set(display_errors, 0); // 不显示错误$limit $this->request->post(limit, 20, intval);$offset $this->request->post(offset, 0, intval);$page floor($offset / $limit) 1 ;$wh…...

Docker3:docker基础1

欢迎来到“雪碧聊技术”CSDN博客&#xff01; 在这里&#xff0c;您将踏入一个专注于Java开发技术的知识殿堂。无论您是Java编程的初学者&#xff0c;还是具有一定经验的开发者&#xff0c;相信我的博客都能为您提供宝贵的学习资源和实用技巧。作为您的技术向导&#xff0c;我将…...

18. 【.NET 8 实战--孢子记账--从单体到微服务】--记账模块--账本

这一篇我们来一起为账本功能编写代码。账本功能的代码很简单&#xff0c;就是一些简单的CURD操作。 一、需求 我们先来看一下需求&#xff1a; 编号需求说明1新增账本1. 账本名称不能和用户已有的账本名称重复2删除账本1. 存在收支记录的账本不能删除3修改账本1. 修改的账本…...

GPT1.0 和 GPT2.0 的联系与区别

随着自然语言处理技术的飞速发展&#xff0c;OpenAI 提出的 GPT 系列模型成为了生成式预训练模型的代表。作为 GPT 系列的两代代表&#xff0c;GPT-1 和 GPT-2 虽然在架构上有着继承关系&#xff0c;但在设计理念和性能上有显著的改进。本文将从模型架构、参数规模、训练数据和…...

在 Taro 中实现系统主题适配:亮/暗模式

目录 背景实现方案方案一&#xff1a;CSS 变量 prefers-color-scheme 媒体查询什么是 prefers-color-scheme&#xff1f;代码示例 方案二&#xff1a;通过 JavaScript 监听系统主题切换 背景 用Taro开发的微信小程序&#xff0c;需求是页面的UI主题想要跟随手机系统的主题适配…...

uni-app 界面TabBar中间大图标设置的两种方法

一、前言 最近写基于uni-app 写app项目的时候&#xff0c;底部导航栏 中间有一个固定的大图标&#xff0c;并且没有激活状态。这里记录下实现方案。效果如下&#xff08;党组织这个图标&#xff09;&#xff1a; 方法一&#xff1a;midButton的使用 官方文档&#xff1a;ta…...

leetcode 无重复字符的最长子串

3. 无重复字符的最长子串 已解答 中等 相关标签 相关企业 提示 给定一个字符串 s &#xff0c;请你找出其中不含有重复字符的 最长子串的长度。 提示&#xff1a; 0 < s.length < 5 * 104s 由英文字母、数字、符号和空格组成 class Solution:def lengthOfLongest…...

【C++习题】14.滑动窗口_找到字符串中所有字母异位词

文章目录 题目链接&#xff1a;题目描述&#xff1a;解法C 算法代码&#xff1a;图解 题目链接&#xff1a; 438. 找到字符串中所有字母异位词 题目描述&#xff1a; 解法 暴力解法&#xff1a; 字母排序后运用滑动窗口解题。 滑动窗口哈希表&#xff1a; 我们可以优化一下&am…...

matplotlib知识

问题与解决 1.module backend_interagg has no attribute FigureCanvas问题 Matplotlib 后端不兼容: matplotlib 使用的后端&#xff08;如 backend_interagg&#xff09;可能与当前环境不匹配或未正确加载。 在代码中显式设置一个兼容的后端&#xff0c;例如 TkAgg、Qt5Ag…...

如何在ubuntu上调试core dump

启用core dump 确认ulimit 状态 ulimit -c 如果输出是0&#xff0c;表示core dump被禁用了 运行 ulimit -c unlimited 再次运行 ulimit -c 确认输出是ulimited 设置core dump路径和文件名格式 下面命令表示设置core dump文件在当前目录&#xff08;%e表示程序名&#x…...

Spring Boot教程之五:在 IntelliJ IDEA 中运行第一个 Spring Boot 应用程序

在 IntelliJ IDEA 中运行第一个 Spring Boot 应用程序 IntelliJ IDEA 是一个用 Java 编写的集成开发环境 (IDE)。它用于开发计算机软件。此 IDE 由 Jetbrains 开发&#xff0c;提供 Apache 2 许可社区版和商业版。它是一种智能的上下文感知 IDE&#xff0c;可用于在各种应用程序…...

排序算法1

排序算法是《数据结构与算法》中最基本的算法之一。 排序算法可以分为内部排序和外部排序&#xff0c;内部排序是数据记录在内存中进行排序&#xff0c;而外部排序是因排序的数据很大&#xff0c;一次不能容纳全部的排序记录&#xff0c;在排序过程中需要访问外存。 常见的内部…...

vector, list 模拟实现

vector 实现 成员属性/迭代器 template<class T> class vector { public:typedef T* iterator;typedef const T* const_iterator;iterator begin() {return _first; }iterator end() {return _end; }const_iterator begin() const {return _first; }const_iterator end…...

中国近代传奇战役

军事战略层面的传奇战役 孟良崮战役&#xff1a;1947年5月&#xff0c;陈毅、粟裕指挥华东野战军在山东孟良崮地区对国民党军进行的一次大规模山地运动歼灭战。此役&#xff0c;我军出其不意地对国民党最强大的王牌之首第七十四师开战&#xff0c;并将其全歼。战役中&#xff…...

微信小程序页面配置详解:从入门到精通

微信小程序页面配置详解:从入门到精通 引言 随着移动互联网的飞速发展,微信小程序作为一种新兴的应用形式,因其便捷性和丰富的功能而受到广泛欢迎。在小程序的开发过程中,页面配置是至关重要的一环。本文将深入探讨微信小程序的页面配置,帮助开发者从基础到高级逐步掌握…...

C#基础题

6.在屏幕上输出如下所示数列&#xff1a;1 1 2 3 5 8 13 21……an(an<10000) 7.求任意两个整数之间所有整数的平方和&#xff1f;&#xff08;要求从键盘输入任意两个整数&#xff0c;调用已定义函数求和&#xff09; 8.将一个二维数组行和列元素互换&#xff0c;存…...

前端开发中v-if 与v-show的区别

v-if v-if指令用于条件性地渲染一块内容。这个块只有当指令的表达式返回true时才会被渲染。 ‌工作原理‌&#xff1a;v-if通过动态地创建和销毁元素来控制元素的显示与隐藏。当条件为false时&#xff0c;对应的元素及其绑定的事件监听器和子组件都会被销毁&#xff1b;当条件…...

Django实现智能问答助手-基础配置

设置 Django 项目、创建应用、定义模型和视图、实现问答逻辑&#xff0c;并设计用户界面。下面是一步一步的简要说明&#xff1a; 目录&#xff1a; QnAAssistant/ # 项目目录 │ ├── QnAAssistant/ # 项目文件夹 │ ├── init.py # 空文件 │ ├── settings.py # 项目配…...

2024-11-25 二叉树的定义

一、基本概念 1.二叉树是n(n>0)个结点的有限集合: ① 或者为空二叉树&#xff0c;即n0。 ②或者由一个根结点和两个互不相交的被称为根的左子树和右子树组成。左子树和右子树又分别是一棵二叉树。 特点&#xff1a; ①每个结点至多只有两棵子树。 ②左右子树不能颠倒&am…...

构建高效 Redis 集群:从问题排查到最佳实践20241125

引言&#xff1a;Redis 集群的重要性 Redis 作为一款高性能的内存数据库&#xff0c;常用于高并发场景&#xff0c;比如缓存、消息队列和排行榜。通过构建 Redis 集群&#xff0c;可以进一步提升可用性与性能。然而&#xff0c;集群的部署并非一帆风顺&#xff0c;常会遇到各种…...

MyBatis多表映射

一、多表映射概念: 1.多表查询结果映射思路: MyBatis思想是:数据库不可能永远是你所想或所需的那个样子。 我们希望每个数据库都具备良好的第三范式或BCNF范式&#xff0c;可惜它们并不都是那样。 如果能有一种数据库映射模式&#xff0c;完美适配所有的应用程序查询需求&…...

[M最短路] lc743. 网络延迟时间(spfa最短路+单源最短路)

文章目录 1. 题目来源2. 题目解析 1. 题目来源 链接&#xff1a;743. 网络延迟时间 相关链接&#xff1a; [图最短路模板] 五大最短路常用模板) 2. 题目解析 怎么讲呢&#xff0c;挺抽象的…很久没写最短路算法了。反正也是写出来了&#xff0c;但脱离了模板&#xff0c;把…...

使用nvm下载多个版本node后提示vue不是内部或外部命令,执行vue create报.vuerc错误

一、使用nvm后执行含vue的相关命令提示vue不是内部或外部命令 前言&#xff1a;之前有项目需要切换node版本&#xff0c;我把node卸载了然后使用nvm下载多个版本的node。现在想通过vue create搭建vue2的项目时提示vue不是内部或外部命令&#xff0c;执行npm i vue/cli后仍然无…...

高端服务器可以防护哪些攻击?

高端服务器&#xff0c;尤其是那些专门设计用于防御网络攻击的高防服务器&#xff0c;能够提供多种层次的防护&#xff0c;以抵御不同类型的网络攻击。以下是高端服务器可以防御的主要攻击类型&#xff1a; 1. DDoS攻击&#xff08;分布式拒绝服务攻击&#xff09; 带宽消耗攻…...

助力花生作物智能化采摘,基于嵌入式端超轻量级模型LeYOLO全系列【n/s/m/l】参数模型开发构建花生种植采摘场景下花生果实智能检测计数系统

秋天&#xff0c;是大地回馈辛勤耕耘者的季节&#xff0c;金黄的稻田、硕果累累的果园、还有那一片片郁郁葱葱的花生地&#xff0c;共同绘制出一幅幅丰收的画卷。对于农民而言&#xff0c;秋收不仅仅是收获的季节&#xff0c;更是他们与土地情感交织、汗水与希望交织的见证。花…...

物联网无线局域网WiFi开发(二):WiFi_RTOS_SDK

一、编译工程模板 &#xff08;一&#xff09;搭建app目录 在SDK目录下新建app目录 cd 到examples目录下 拷贝smart_config下所有文件到app目录下 cd 到app目录下查看文件是否拷贝成功 (二)修改gen_misc.sh vim 打开gen_misc.sh进行编辑 修改SDK_PATH为当前SDK路径&#xf…...

GitLab|应用部署

创建docker-compose.yaml文件 输入docker-compose配置 version: 3.8 services:gitlab:image: gitlab/gitlab-ce:15.11.2-ce.0restart: alwayscontainer_name: gitlab-ceprivileged: truehostname: 192.168.44.235environment:TZ: Asia/ShanghaiGITLAB_OMNIBUS_CONFIG: |exter…...

替换Nacos的MySQL驱动

前言&#xff1a;替换Nacos的MySQL驱动能实现使Nacos支持MySQL8.0及以上版本的MySQL数据库 注&#xff1a;下述教程会使用命令先解压Nacos的jar包然后重新用命令把Nacos压缩成jar包&#xff0c;不然直接用压缩工具替换MySQL驱动后的Nacos是会启动不起来的&#xff08;因为没有替…...

链表内指定区间反转

描述 将一个节点数为 size 链表 m 位置到 n 位置之间的区间反转&#xff0c;要求时间复杂度 O(n)O(n)&#xff0c;空间复杂度 O(1)O(1)。 例如&#xff1a; 给出的链表为 1→2→3→4→5→NULL1→2→3→4→5→NULL, m2,n4m2,n4, 返回 1→4→3→2→5→NULL1→4→3→2→5→NULL. …...

jmeter5.6.3安装教程

一、官网下载 需要提前配置好jdk的环境变量 jmeter官网&#xff1a;https://jmeter.apache.org/download_jmeter.cgi 选择点击二进制的zip文件 下载成功后&#xff0c;默认解压下一步&#xff0c;更改安装路径就行(我安装在D盘) 实用jmeter的bin目录作为系统变量 然后把这…...

JavaScript高级程序设计基础(五)

上接语言基础&#xff1a;JavaScript高级程序设计基础&#xff08;四&#xff09; 本节内容较简单&#xff0c;有一定语言基础的可以跳过 2.5 语句 2.5.1 if语句 具体作用不做过多赘述。需要注意的是&#xff0c;在判断条件里会自动调用Boolean()&#xff1b;并且在执行语句…...

Stable Diffusion 3 部署笔记

SD3下载地址&#xff1a;https://huggingface.co/stabilityai/stable-diffusion-3-medium/tree/main https://huggingface.co/spaces/stabilityai/stable-diffusion-3-medium comfyui 教程&#xff1a; 深度测评&#xff1a;SD3模型表现如何&#xff1f;实用教程助你玩转Stabl…...

深度解析:Vue 自定义指令到底是什么?快来了解

自定义指令的概述 在Vue中,自定义指令是开发者自定义的,用来在DOM元素上执行特定操作的功能。Vue本身提供了多种内建指令(如v-bind, v-model, v-for, v-if等),但有时候我们需要创建自己的指令来实现一些特殊功能。这些功能可以是对DOM的直接操作,或者是为了满足特定的业…...

CVE-2022-4230

打开什么都没有 使用dirsearch扫描到一个wp-admin 访问wp-admin是一个登陆页面 账号密码都在标题中 登陆后是这个页面 在WP Statistics < 13.2.9 – 经过身份验证的 SQLi |CVE 2022-4230 |插件漏洞 (wpscan.com)中&#xff0c;里边有一段对漏洞的描述。 https://wpscan.com…...

什么是 WPF 中的依赖属性?有什么作用?

依赖属性&#xff08;Dependency Property&#xff09;是 WPF 的一个核心概念&#xff0c;它为传统的 .NET 属性提供了增强功能&#xff0c;支持绑定、样式、动画和默认值等功能。通过依赖属性&#xff0c;WPF 提供了一种灵活的数据驱动的方式来处理 UI 属性。 1. 什么是依赖属…...

『 Linux 』网络层 - IP协议 (二)

文章目录 路由NAT技术分片与组装分片的组装IP协议分片的短板 路由 通常情况路由器具备了一个非常重要的功能,即构建子网; 同时路由器需要实现跨网络通信,说明路由器必须存在两个或以上的IP地址,通常在路由器中可以看到几个接口,分别是一个WAN口和几个LAN口; WAN口IP被称为公网I…...

Linux开发者的CI/CD(11)jenkins变量

文章目录 1. **环境变量 (Environment Variables)**常见的环境变量:示例:2. **构建参数 (Build Parameters)**常见的构建参数类型:示例:3 **在 `stages` 块内定义局部变量**示例:使用 `script` 步骤定义局部变量4 变量引用陷阱在 Jenkins 中,变量是自动化流程中非常重要的…...

Python和R荧光分光光度法

&#x1f335;Python片段 Python在处理荧光分光光度法数据方面非常强大&#xff0c;得益于其丰富的数据处理和可视化库&#xff0c;可以轻松实现从数据读取到分析的完整流程。荧光分光光度法用于测量物质在激发光照射下发出的荧光强度&#xff0c;常用于定量分析和特性研究。 …...

理解clickhouse 里的分区和分片键区别

文章目录 分片分区两分片&#xff0c;0副本的cluster 分片 CREATE TABLE logs_distributed AS logs_local ENGINE Distributed(cluster_name, -- 集群名称database_name, -- 数据库名称logs_local, -- 本地表名cityHash64(user_id) -- 分片键&#xf…...

【数据结构笔记】习题

渐进分析 【2010-THU-Mid】f(n) O(g(n))&#xff0c;当且仅当g(n) Ω(f(n))。&#xff08;√&#xff09; 【2010-THU-Mid】若f(n) O(n^2)且g(n) O(n)&#xff0c;则以下结论正确的是&#xff08;AD&#xff09; A. f(n) g(n) O(n^2) B. f(n) / g(n) O(n) C. g(n) O(f(…...

非交换几何与黎曼ζ函数:数学中的一场革命性对话

非交换几何与黎曼ζ函数&#xff1a;数学中的一场革命性对话 非交换几何&#xff08;Noncommutative Geometry, NCG&#xff09;是数学的一个分支领域&#xff0c;它将经典的几何概念扩展到非交换代数的框架中。非交换代数是一种结合代数&#xff0c;其中乘积不是交换性的&…...

【c++】模板详解(2)

&#x1f31f;&#x1f31f;作者主页&#xff1a;ephemerals__ &#x1f31f;&#x1f31f;所属专栏&#xff1a;C 目录 前言 一、非类型模板参数 二、模板的特化 1. 概念 2. 场景举例 3. 函数模板的特化 4. 类模板的特化 全特化 偏特化 1. 部分特化 2. 对参数的…...