上方為中文說明
Chinese description above
下方英文說明為 Google 翻譯
The English description below is Google Translate
測試 PHP Laravel 專案連接 Hadoop Hive server
git clone https://github.com/q0015300153/test-hive.git
cp test-hive
composer install
cp .env.example .env
php artisan key:generate
routes/web.php
Route::match(['get'], '/hive', [
'uses' => 'Hive@test',
]);
app/Http/Controllers/Hive.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Hive extends Controller
{
public function test(Request $request)
{
$hive = new \ThriftSQL\Hive('hive-server', 10000, 'root', 'root', 30);
$hiveTables = $hive
->connect()
->getIterator('SHOW TABLES');
$hive->disconnect();
dd($hiveTables);
}
}
Test PHP Laravel project connection Hadoop Hive server
git clone https://github.com/q0015300153/test-hive.git
cp test-hive
composer install
cp .env.example .env
php artisan key:generate
routes/web.php
Route::match(['get'], '/hive', [
'uses' => 'Hive@test',
]);
app/Http/Controllers/Hive.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class Hive extends Controller
{
public function test(Request $request)
{
$hive = new \ThriftSQL\Hive('hive-server', 10000, 'root', 'root', 30);
$hiveTables = $hive
->connect()
->getIterator('SHOW TABLES');
$hive->disconnect();
dd($hiveTables);
}
}